diff --git a/Assets/Scripts/InputActions.cs b/Assets/Scripts/InputActions.cs index 2e4c604..a4e987a 100644 --- a/Assets/Scripts/InputActions.cs +++ b/Assets/Scripts/InputActions.cs @@ -92,6 +92,61 @@ public partial class @InputActions: IInputActionCollection2, IDisposable ""action"": ""Movement"", ""isComposite"": false, ""isPartOfComposite"": true + }, + { + ""name"": ""2D Vector"", + ""id"": ""2bc3f525-a5a8-4d0f-a679-5b0d8dcff168"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Movement"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""a7ed1fe9-4819-4055-840d-284172ef0cba"", + ""path"": ""/leftStick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Movement"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""f1b7a29e-55b7-4a22-b2db-fceee993e456"", + ""path"": ""/leftStick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Movement"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""e1be144e-9344-47d0-ad6a-4160bb893bcb"", + ""path"": ""/leftStick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Movement"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""150c31e4-d3d8-4d14-9f07-3185561a86ba"", + ""path"": ""/leftStick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Movement"", + ""isComposite"": false, + ""isPartOfComposite"": true } ] } diff --git a/Assets/Scripts/InputActions.inputactions b/Assets/Scripts/InputActions.inputactions index 6474de6..ad0b321 100644 --- a/Assets/Scripts/InputActions.inputactions +++ b/Assets/Scripts/InputActions.inputactions @@ -70,6 +70,61 @@ "action": "Movement", "isComposite": false, "isPartOfComposite": true + }, + { + "name": "2D Vector", + "id": "2bc3f525-a5a8-4d0f-a679-5b0d8dcff168", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Movement", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "a7ed1fe9-4819-4055-840d-284172ef0cba", + "path": "/leftStick/up", + "interactions": "", + "processors": "", + "groups": "", + "action": "Movement", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "f1b7a29e-55b7-4a22-b2db-fceee993e456", + "path": "/leftStick/down", + "interactions": "", + "processors": "", + "groups": "", + "action": "Movement", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "e1be144e-9344-47d0-ad6a-4160bb893bcb", + "path": "/leftStick/left", + "interactions": "", + "processors": "", + "groups": "", + "action": "Movement", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "150c31e4-d3d8-4d14-9f07-3185561a86ba", + "path": "/leftStick/right", + "interactions": "", + "processors": "", + "groups": "", + "action": "Movement", + "isComposite": false, + "isPartOfComposite": true } ] } diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 7cb9a6c..36a35a8 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -30,7 +30,7 @@ public class Player : Character public event EventHandler OnPlayerTakeItem; - public InputActions _inputActions = new InputActions(); + private InputActions _inputActions; private void Awake() { @@ -43,9 +43,19 @@ public class Player : Character PlayerPrefs.SetString("lastExitName", string.Empty); Instance = this; DontDestroyOnLoad(gameObject); + _inputActions = new InputActions(); + } + + private void OnEnable() + { _inputActions.Enable(); } + private void OnDisable() + { + _inputActions.Disable(); + } + public void AddCoin() { _totalCoins++;