Add controller control

This commit is contained in:
Samir Badi 2023-10-30 23:18:05 -04:00
parent 7ead561296
commit 7cebbfc42b
3 changed files with 105 additions and 17 deletions

View File

@ -31,7 +31,7 @@ public partial class @GameInputs: IInputActionCollection2, IDisposable
""name"": ""Movement"",
""type"": ""Value"",
""id"": ""39923aa3-9a9e-4368-8ceb-bebf8ec65530"",
""expectedControlType"": ""Axis"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
@ -42,7 +42,7 @@ public partial class @GameInputs: IInputActionCollection2, IDisposable
""id"": ""436a199c-9091-4d2b-a0e8-afd8675d45f0"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""interactions"": ""Press"",
""initialStateCheck"": false
}
],
@ -58,10 +58,21 @@ public partial class @GameInputs: IInputActionCollection2, IDisposable
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""33b2a668-c24d-4232-ac55-ff4e3bb2c69e"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""AD"",
""id"": ""3ee35364-2c5b-43ec-bcfe-5cceafd1bf45"",
""path"": ""1DAxis"",
""id"": ""4c9ec82f-24c0-457d-910e-feb2d226f3a7"",
""path"": ""2DVector(mode=1)"",
""interactions"": """",
""processors"": """",
""groups"": """",
@ -70,8 +81,30 @@ public partial class @GameInputs: IInputActionCollection2, IDisposable
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""c9f367f7-68bb-47d3-aa78-d9d579a69db0"",
""name"": ""up"",
""id"": ""84119425-90ec-4c8f-b441-53906d174e00"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""c1460f5a-ec6b-455b-a677-ebb7c53419fd"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""7fc0be6f-4d53-4398-b950-60f5c281ac36"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
@ -81,8 +114,8 @@ public partial class @GameInputs: IInputActionCollection2, IDisposable
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""1b04a4aa-9990-4bcd-97b2-b98061031ba4"",
""name"": ""right"",
""id"": ""17a08552-5a32-446d-b856-078d633a06ae"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
@ -90,6 +123,17 @@ public partial class @GameInputs: IInputActionCollection2, IDisposable
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""3c53f63f-69a0-4bea-b572-f92acc6c6d98"",
""path"": ""<Gamepad>/leftStick"",
""interactions"": """",
""processors"": ""StickDeadzone"",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}

View File

@ -9,7 +9,7 @@
"name": "Movement",
"type": "Value",
"id": "39923aa3-9a9e-4368-8ceb-bebf8ec65530",
"expectedControlType": "Axis",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
@ -20,7 +20,7 @@
"id": "436a199c-9091-4d2b-a0e8-afd8675d45f0",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"interactions": "Press",
"initialStateCheck": false
}
],
@ -36,10 +36,21 @@
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "33b2a668-c24d-4232-ac55-ff4e3bb2c69e",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "AD",
"id": "3ee35364-2c5b-43ec-bcfe-5cceafd1bf45",
"path": "1DAxis",
"id": "4c9ec82f-24c0-457d-910e-feb2d226f3a7",
"path": "2DVector(mode=1)",
"interactions": "",
"processors": "",
"groups": "",
@ -48,8 +59,30 @@
"isPartOfComposite": false
},
{
"name": "negative",
"id": "c9f367f7-68bb-47d3-aa78-d9d579a69db0",
"name": "up",
"id": "84119425-90ec-4c8f-b441-53906d174e00",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Movement",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "c1460f5a-ec6b-455b-a677-ebb7c53419fd",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Movement",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "7fc0be6f-4d53-4398-b950-60f5c281ac36",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
@ -59,8 +92,8 @@
"isPartOfComposite": true
},
{
"name": "positive",
"id": "1b04a4aa-9990-4bcd-97b2-b98061031ba4",
"name": "right",
"id": "17a08552-5a32-446d-b856-078d633a06ae",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
@ -68,6 +101,17 @@
"action": "Movement",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "3c53f63f-69a0-4bea-b572-f92acc6c6d98",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "StickDeadzone",
"groups": "",
"action": "Movement",
"isComposite": false,
"isPartOfComposite": false
}
]
}

View File

@ -48,7 +48,7 @@ public class PlayerInputHandler : MonoBehaviour
private void ProcessInput()
{
MoveAxis = _input.Player.Movement.ReadValue<float>();
MoveAxis = _input.Player.Movement.ReadValue<Vector2>().x;
}
private void ClearInput()