Added interact input

This commit is contained in:
OverflowNarhoym
2022-02-22 09:49:48 +01:00
parent 696340a434
commit 376aedc6fc
6 changed files with 221 additions and 139 deletions

View File

@@ -46,6 +46,15 @@ namespace Input
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Interact"",
""type"": ""Button"",
""id"": ""a0a57f7b-062d-458c-a85a-d6030c412835"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -136,6 +145,28 @@ namespace Input
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""4eb9a209-b978-4daf-927a-2f013348d294"",
""path"": ""<Keyboard>/z"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyBoard"",
""action"": ""Interact"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c2dc0361-1191-4641-97e6-d105f64ee7ff"",
""path"": ""<Gamepad>/buttonEast"",
""interactions"": """",
""processors"": """",
""groups"": ""Controller"",
""action"": ""Interact"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -169,6 +200,7 @@ namespace Input
m_PlayerControl = asset.FindActionMap("PlayerControl", throwIfNotFound: true);
m_PlayerControl_Move = m_PlayerControl.FindAction("Move", throwIfNotFound: true);
m_PlayerControl_Jump = m_PlayerControl.FindAction("Jump", throwIfNotFound: true);
m_PlayerControl_Interact = m_PlayerControl.FindAction("Interact", throwIfNotFound: true);
}
public void Dispose()
@@ -230,12 +262,14 @@ namespace Input
private IPlayerControlActions m_PlayerControlActionsCallbackInterface;
private readonly InputAction m_PlayerControl_Move;
private readonly InputAction m_PlayerControl_Jump;
private readonly InputAction m_PlayerControl_Interact;
public struct PlayerControlActions
{
private @PlayerInput m_Wrapper;
public PlayerControlActions(@PlayerInput wrapper) { m_Wrapper = wrapper; }
public InputAction @Move => m_Wrapper.m_PlayerControl_Move;
public InputAction @Jump => m_Wrapper.m_PlayerControl_Jump;
public InputAction @Interact => m_Wrapper.m_PlayerControl_Interact;
public InputActionMap Get() { return m_Wrapper.m_PlayerControl; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -251,6 +285,9 @@ namespace Input
@Jump.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnJump;
@Jump.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnJump;
@Jump.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnJump;
@Interact.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnInteract;
@Interact.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnInteract;
@Interact.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnInteract;
}
m_Wrapper.m_PlayerControlActionsCallbackInterface = instance;
if (instance != null)
@@ -261,6 +298,9 @@ namespace Input
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
@Interact.started += instance.OnInteract;
@Interact.performed += instance.OnInteract;
@Interact.canceled += instance.OnInteract;
}
}
}
@@ -287,6 +327,7 @@ namespace Input
{
void OnMove(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
void OnInteract(InputAction.CallbackContext context);
}
}
}

View File

@@ -22,6 +22,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Interact",
"type": "Button",
"id": "a0a57f7b-062d-458c-a85a-d6030c412835",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -112,6 +121,28 @@
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "4eb9a209-b978-4daf-927a-2f013348d294",
"path": "<Keyboard>/z",
"interactions": "",
"processors": "",
"groups": "KeyBoard",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "c2dc0361-1191-4641-97e6-d105f64ee7ff",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "Controller",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
}
]
}