From 18a2fd7ef7e492a94d52de6e9712ee4a8ec1bc71 Mon Sep 17 00:00:00 2001 From: Stedd Date: Sun, 18 Sep 2022 10:18:49 +0200 Subject: [PATCH] Handlers updates *Updated Input system for handlers, now scripts are not depentent on being a child of input system in the hierarchy *Minor cleanups *Changed hierarchy in scene (no longer children of inputsystem) --- Assets/Handlers/BuildingHandler.cs | 42 +- Assets/Handlers/EnemyHandler.cs | 2 +- Assets/Handlers/HandlerBase.cs | 33 + Assets/Handlers/HandlerBase.cs.meta | 11 + Assets/Handlers/Handlers.asmdef | 3 +- Assets/Handlers/ScoreHandler.cs | 38 +- Assets/InputSystem/HandlerControls.cs | 1154 +++++++++++++++++ Assets/InputSystem/HandlerControls.cs.meta | 11 + ...utactions => HandlerControls.inputactions} | 0 ...meta => HandlerControls.inputactions.meta} | 4 +- Assets/Scenes/Playground.unity | 129 +- 11 files changed, 1287 insertions(+), 140 deletions(-) create mode 100644 Assets/Handlers/HandlerBase.cs create mode 100644 Assets/Handlers/HandlerBase.cs.meta create mode 100644 Assets/InputSystem/HandlerControls.cs create mode 100644 Assets/InputSystem/HandlerControls.cs.meta rename Assets/InputSystem/{AsteroidGame.inputactions => HandlerControls.inputactions} (100%) rename Assets/InputSystem/{AsteroidGame.inputactions.meta => HandlerControls.inputactions.meta} (84%) diff --git a/Assets/Handlers/BuildingHandler.cs b/Assets/Handlers/BuildingHandler.cs index bf675df..abed3ea 100644 --- a/Assets/Handlers/BuildingHandler.cs +++ b/Assets/Handlers/BuildingHandler.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using AsteroidGame.Entities.Structures.Scripts; using UnityEngine; @@ -6,42 +5,51 @@ using UnityEngine.InputSystem; namespace AsteroidGame.Handlers { - public class BuildingHandler : MonoBehaviour + public class BuildingHandler : HandlerBase { - [Header("Connections")] [SerializeField] - private Camera _camera; + [Header("Connections")] + [SerializeField] private new Camera camera ; - [Header("Assigned on start")] [SerializeField] - int buildingSelector = 0; + [Header("State")] + [SerializeField] private int buildingSelector; - [Header("Prefabs")] [SerializeField] private List buildings = new List(); + [Header("Prefabs")] + [SerializeField] private List buildings = new(); #region Private - + [SerializeField] private List activeBuildings; private Vector3 _tempVec; private Plane _buildPlane; - private StructureBase _tempSB; + private StructureBase _tempSb; #endregion - private void OnEnable() - { - activeBuildings.Clear(); - } - private void OnClick(InputValue value) + protected override void OnEnable() + { + base.OnEnable(); + activeBuildings.Clear(); + camera = Camera.main; + } + + protected override void OnClick(InputAction.CallbackContext a) + { + PlaceBuilding(); + } + + private void PlaceBuilding() { _buildPlane = new Plane(Vector3.up, Vector3.zero); - Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue()); + Ray ray = camera.ScreenPointToRay(Mouse.current.position.ReadValue()); if (_buildPlane.Raycast(ray, out float distance)) { _tempVec = ray.GetPoint(distance); } - _tempSB = Instantiate(buildings[buildingSelector], _tempVec, Quaternion.identity, transform); + _tempSb = Instantiate(buildings[buildingSelector], _tempVec, Quaternion.identity, transform); - activeBuildings.Add(_tempSB); + activeBuildings.Add(_tempSb); } } } \ No newline at end of file diff --git a/Assets/Handlers/EnemyHandler.cs b/Assets/Handlers/EnemyHandler.cs index 9a4b843..1aa8064 100644 --- a/Assets/Handlers/EnemyHandler.cs +++ b/Assets/Handlers/EnemyHandler.cs @@ -4,7 +4,7 @@ using UnityEngine.Pool; namespace AsteroidGame.Handlers { - public class EnemyHandler : MonoBehaviour + public class EnemyHandler : HandlerBase { [Header("Parameters")] [SerializeField] [Range(0.1f, 60f)] float spawnRate = 60f; diff --git a/Assets/Handlers/HandlerBase.cs b/Assets/Handlers/HandlerBase.cs new file mode 100644 index 0000000..c0ae706 --- /dev/null +++ b/Assets/Handlers/HandlerBase.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using UnityEngine.InputSystem; + +namespace AsteroidGame.Handlers +{ + public class HandlerBase : MonoBehaviour + { + + private HandlerControls _handlerControls; + + private void Awake() + { + _handlerControls = new HandlerControls(); + } + + protected virtual void OnEnable() + { + _handlerControls.Player.Enable(); + _handlerControls.Player.Click.performed += OnClick; + } + + protected virtual void OnDisable() + { + _handlerControls.Player.Click.performed -= OnClick; + _handlerControls.Player.Disable(); + } + + protected virtual void OnClick(InputAction.CallbackContext a) + { + + } + } +} diff --git a/Assets/Handlers/HandlerBase.cs.meta b/Assets/Handlers/HandlerBase.cs.meta new file mode 100644 index 0000000..a7187d2 --- /dev/null +++ b/Assets/Handlers/HandlerBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e5fa0aaf29861743b120f4e08c5306d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Handlers/Handlers.asmdef b/Assets/Handlers/Handlers.asmdef index 609eb04..722a938 100644 --- a/Assets/Handlers/Handlers.asmdef +++ b/Assets/Handlers/Handlers.asmdef @@ -5,7 +5,8 @@ "GUID:6055be8ebefd69e48b49212b09b47b2f", "GUID:f26d68a0bdefa1043b120b820f55e190", "GUID:bc7863ca0989b494d84426bfd28432fa", - "GUID:75469ad4d38634e559750d17036d5f7c" + "GUID:75469ad4d38634e559750d17036d5f7c", + "GUID:f008ecc6829887e478aeb5eb004eb01b" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/Handlers/ScoreHandler.cs b/Assets/Handlers/ScoreHandler.cs index 7004477..f4ce5b2 100644 --- a/Assets/Handlers/ScoreHandler.cs +++ b/Assets/Handlers/ScoreHandler.cs @@ -1,23 +1,29 @@ using TMPro; using UnityEngine; using UnityEngine.SceneManagement; +using UnityEngine.Serialization; namespace AsteroidGame.Handlers { - public class ScoreHandler : MonoBehaviour + public class ScoreHandler : HandlerBase { [Header("UI")] - [SerializeField] TextMeshProUGUI dispayBalance; + [SerializeField] + private TextMeshProUGUI displayBalance; [Header("Parameters")] - [SerializeField] int startHealth = 5; - [SerializeField] int startBalance = 100; + [SerializeField] + private int startHealth = 5; + [SerializeField] + private int startBalance = 100; [Header("Stats")] - [SerializeField] int currentHealth; - [SerializeField] int currentBalance; - public int CurrentBalance {get {return currentBalance;}} + [SerializeField] + private int currentHealth; + [SerializeField] + private int currentBalance; + public int CurrentBalance => currentBalance; - void Start() + private void Start() { currentHealth = startHealth; currentBalance = startBalance; @@ -30,13 +36,13 @@ namespace AsteroidGame.Handlers CheckIfYouLost(); } - public void ModifyHealth(int _amount) + public void ModifyHealth(int amount) { - currentHealth += _amount; + currentHealth += amount; CheckIfYouLost(); } - void CheckIfYouLost(){ + private void CheckIfYouLost(){ if(currentHealth <= 0) { Debug.Log("You lost"); @@ -44,20 +50,20 @@ namespace AsteroidGame.Handlers } } - public void ModifyWealth(int _amount){ - currentBalance += _amount; + public void ModifyWealth(int amount){ + currentBalance += amount; UpdateGUI(); // Debug.Log($"Wealth modification. Change:{_amount}. Current: {wealthAmount}"); } - void Reload() + private void Reload() { int currentSceneIndex = SceneManager.GetActiveScene().buildIndex; SceneManager.LoadScene(currentSceneIndex); } - void UpdateGUI(){ - dispayBalance.text = $"Gold: {currentBalance.ToString()}"; + private void UpdateGUI(){ + displayBalance.text = $"Gold: {currentBalance.ToString()}"; } } diff --git a/Assets/InputSystem/HandlerControls.cs b/Assets/InputSystem/HandlerControls.cs new file mode 100644 index 0000000..22ea559 --- /dev/null +++ b/Assets/InputSystem/HandlerControls.cs @@ -0,0 +1,1154 @@ +//------------------------------------------------------------------------------ +// +// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator +// version 1.3.0 +// from Assets/InputSystem/HandlerControls.inputactions +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Utilities; + +namespace AsteroidGame +{ + public partial class @HandlerControls : IInputActionCollection2, IDisposable + { + public InputActionAsset asset { get; } + public @HandlerControls() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""HandlerControls"", + ""maps"": [ + { + ""name"": ""Player"", + ""id"": ""a0839633-789b-43c4-96e8-4b06ad0df6f7"", + ""actions"": [ + { + ""name"": ""Move"", + ""type"": ""Value"", + ""id"": ""7a6c0190-d56d-4da5-bc75-c47ee4143d4c"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Look"", + ""type"": ""Value"", + ""id"": ""7a8d4301-f9d3-4c1d-9691-a6080f8ae66f"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Click"", + ""type"": ""Button"", + ""id"": ""c7463e6d-1380-4e73-9edf-f690e3eabd4e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""978bfe49-cc26-4a3d-ab7b-7d7a29327403"", + ""path"": ""/leftStick"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": ""WASD"", + ""id"": ""00ca640b-d935-4593-8157-c05846ea39b3"", + ""path"": ""Dpad"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""e2062cb9-1b15-46a2-838c-2f8d72a0bdd9"", + ""path"": ""/w"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""up"", + ""id"": ""8180e8bd-4097-4f4e-ab88-4523101a6ce9"", + ""path"": ""/upArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""320bffee-a40b-4347-ac70-c210eb8bc73a"", + ""path"": ""/s"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""1c5327b5-f71c-4f60-99c7-4e737386f1d1"", + ""path"": ""/downArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""d2581a9b-1d11-4566-b27d-b92aff5fabbc"", + ""path"": ""/a"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""2e46982e-44cc-431b-9f0b-c11910bf467a"", + ""path"": ""/leftArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""fcfe95b8-67b9-4526-84b5-5d0bc98d6400"", + ""path"": ""/d"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""77bff152-3580-4b21-b6de-dcd0c7e41164"", + ""path"": ""/rightArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""1635d3fe-58b6-4ba9-a4e2-f4b964f6b5c8"", + ""path"": ""/{Primary2DAxis}"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""XR"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""3ea4d645-4504-4529-b061-ab81934c3752"", + ""path"": ""/stick"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""c1f7a91b-d0fd-4a62-997e-7fb9b69bf235"", + ""path"": ""/rightStick"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Look"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8c8e490b-c610-4785-884f-f04217b23ca4"", + ""path"": ""/delta"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse;Touch"", + ""action"": ""Look"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""3e5f5442-8668-4b27-a940-df99bad7e831"", + ""path"": ""/{Hatswitch}"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Look"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""143bb1cd-cc10-4eca-a2f0-a3664166fe91"", + ""path"": ""/rightTrigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""05f6913d-c316-48b2-a6bb-e225f14c7960"", + ""path"": ""/leftButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""886e731e-7071-4ae4-95c0-e61739dad6fd"", + ""path"": ""/primaryTouch/tap"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Touch"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""ee3d0cd2-254e-47a7-a8cb-bc94d9658c54"", + ""path"": ""/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8255d333-5683-4943-a58a-ccb207ff1dce"", + ""path"": ""/{PrimaryAction}"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""XR"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""UI"", + ""id"": ""7c09289e-9148-4aeb-90c8-13e68d608b93"", + ""actions"": [ + { + ""name"": ""Navigate"", + ""type"": ""PassThrough"", + ""id"": ""20ae2f11-0cff-4b9e-a8bc-9e4991614bbb"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Submit"", + ""type"": ""Button"", + ""id"": ""a852f158-148f-4764-923f-82ab136e1f9c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Cancel"", + ""type"": ""Button"", + ""id"": ""2c8b2d4b-b9a6-4167-9b1c-c253dfb90ca1"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Point"", + ""type"": ""PassThrough"", + ""id"": ""fdeb066f-411a-48b2-9896-9409fee8baf3"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Click"", + ""type"": ""PassThrough"", + ""id"": ""05c47259-ced4-4daa-8dc2-9ccf26ff9632"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""ScrollWheel"", + ""type"": ""PassThrough"", + ""id"": ""87290d81-61b6-491c-859f-4a1a31f60f1f"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""MiddleClick"", + ""type"": ""PassThrough"", + ""id"": ""97ad60d8-d5db-4a14-8a83-c27358422a2e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""RightClick"", + ""type"": ""PassThrough"", + ""id"": ""fa3293a2-4bbc-4f63-b1e8-aa0a7d75ea96"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""TrackedDevicePosition"", + ""type"": ""PassThrough"", + ""id"": ""35072b0b-93e9-4d04-bfe6-5ccaaae85338"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""TrackedDeviceOrientation"", + ""type"": ""PassThrough"", + ""id"": ""e0014bd4-6f96-428c-abdb-daf443019be7"", + ""expectedControlType"": ""Quaternion"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": ""Gamepad"", + ""id"": ""809f371f-c5e2-4e7a-83a1-d867598f40dd"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""14a5d6e8-4aaf-4119-a9ef-34b8c2c548bf"", + ""path"": ""/leftStick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""up"", + ""id"": ""9144cbe6-05e1-4687-a6d7-24f99d23dd81"", + ""path"": ""/rightStick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""2db08d65-c5fb-421b-983f-c71163608d67"", + ""path"": ""/leftStick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""58748904-2ea9-4a80-8579-b500e6a76df8"", + ""path"": ""/rightStick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""8ba04515-75aa-45de-966d-393d9bbd1c14"", + ""path"": ""/leftStick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""712e721c-bdfb-4b23-a86c-a0d9fcfea921"", + ""path"": ""/rightStick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""fcd248ae-a788-4676-a12e-f4d81205600b"", + ""path"": ""/leftStick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""1f04d9bc-c50b-41a1-bfcc-afb75475ec20"", + ""path"": ""/rightStick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""fb8277d4-c5cd-4663-9dc7-ee3f0b506d90"", + ""path"": ""/dpad"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": ""Joystick"", + ""id"": ""e25d9774-381c-4a61-b47c-7b6b299ad9f9"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""3db53b26-6601-41be-9887-63ac74e79d19"", + ""path"": ""/stick/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""0cb3e13e-3d90-4178-8ae6-d9c5501d653f"", + ""path"": ""/stick/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""0392d399-f6dd-4c82-8062-c1e9c0d34835"", + ""path"": ""/stick/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""942a66d9-d42f-43d6-8d70-ecb4ba5363bc"", + ""path"": ""/stick/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""Keyboard"", + ""id"": ""ff527021-f211-4c02-933e-5976594c46ed"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Navigate"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""563fbfdd-0f09-408d-aa75-8642c4f08ef0"", + ""path"": ""/w"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""up"", + ""id"": ""eb480147-c587-4a33-85ed-eb0ab9942c43"", + ""path"": ""/upArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""2bf42165-60bc-42ca-8072-8c13ab40239b"", + ""path"": ""/s"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""85d264ad-e0a0-4565-b7ff-1a37edde51ac"", + ""path"": ""/downArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""74214943-c580-44e4-98eb-ad7eebe17902"", + ""path"": ""/a"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""cea9b045-a000-445b-95b8-0c171af70a3b"", + ""path"": ""/leftArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""8607c725-d935-4808-84b1-8354e29bab63"", + ""path"": ""/d"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""4cda81dc-9edd-4e03-9d7c-a71a14345d0b"", + ""path"": ""/rightArrow"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Navigate"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""9e92bb26-7e3b-4ec4-b06b-3c8f8e498ddc"", + ""path"": ""*/{Submit}"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Submit"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""82627dcc-3b13-4ba9-841d-e4b746d6553e"", + ""path"": ""*/{Cancel}"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Cancel"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""c52c8e0b-8179-41d3-b8a1-d149033bbe86"", + ""path"": ""/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Point"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""e1394cbc-336e-44ce-9ea8-6007ed6193f7"", + ""path"": ""/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Point"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""5693e57a-238a-46ed-b5ae-e64e6e574302"", + ""path"": ""/touch*/position"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Touch"", + ""action"": ""Point"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""4faf7dc9-b979-4210-aa8c-e808e1ef89f5"", + ""path"": ""/leftButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8d66d5ba-88d7-48e6-b1cd-198bbfef7ace"", + ""path"": ""/tip"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""47c2a644-3ebc-4dae-a106-589b7ca75b59"", + ""path"": ""/touch*/press"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Touch"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""bb9e6b34-44bf-4381-ac63-5aa15d19f677"", + ""path"": ""/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""XR"", + ""action"": ""Click"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""38c99815-14ea-4617-8627-164d27641299"", + ""path"": ""/scroll"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""ScrollWheel"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""24066f69-da47-44f3-a07e-0015fb02eb2e"", + ""path"": ""/middleButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""MiddleClick"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""4c191405-5738-4d4b-a523-c6a301dbf754"", + ""path"": ""/rightButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""RightClick"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""7236c0d9-6ca3-47cf-a6ee-a97f5b59ea77"", + ""path"": ""/devicePosition"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""XR"", + ""action"": ""TrackedDevicePosition"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""23e01e3a-f935-4948-8d8b-9bcac77714fb"", + ""path"": ""/deviceRotation"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""XR"", + ""action"": ""TrackedDeviceOrientation"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + } + ], + ""controlSchemes"": [ + { + ""name"": ""Keyboard&Mouse"", + ""bindingGroup"": ""Keyboard&Mouse"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + }, + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Gamepad"", + ""bindingGroup"": ""Gamepad"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Touch"", + ""bindingGroup"": ""Touch"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Joystick"", + ""bindingGroup"": ""Joystick"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""XR"", + ""bindingGroup"": ""XR"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + } + ] +}"); + // Player + m_Player = asset.FindActionMap("Player", throwIfNotFound: true); + m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true); + m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true); + m_Player_Click = m_Player.FindAction("Click", throwIfNotFound: true); + // UI + m_UI = asset.FindActionMap("UI", throwIfNotFound: true); + m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true); + m_UI_Submit = m_UI.FindAction("Submit", throwIfNotFound: true); + m_UI_Cancel = m_UI.FindAction("Cancel", throwIfNotFound: true); + m_UI_Point = m_UI.FindAction("Point", throwIfNotFound: true); + m_UI_Click = m_UI.FindAction("Click", throwIfNotFound: true); + m_UI_ScrollWheel = m_UI.FindAction("ScrollWheel", throwIfNotFound: true); + m_UI_MiddleClick = m_UI.FindAction("MiddleClick", throwIfNotFound: true); + m_UI_RightClick = m_UI.FindAction("RightClick", throwIfNotFound: true); + m_UI_TrackedDevicePosition = m_UI.FindAction("TrackedDevicePosition", throwIfNotFound: true); + m_UI_TrackedDeviceOrientation = m_UI.FindAction("TrackedDeviceOrientation", throwIfNotFound: true); + } + + public void Dispose() + { + UnityEngine.Object.Destroy(asset); + } + + public InputBinding? bindingMask + { + get => asset.bindingMask; + set => asset.bindingMask = value; + } + + public ReadOnlyArray? devices + { + get => asset.devices; + set => asset.devices = value; + } + + public ReadOnlyArray controlSchemes => asset.controlSchemes; + + public bool Contains(InputAction action) + { + return asset.Contains(action); + } + + public IEnumerator GetEnumerator() + { + return asset.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Enable() + { + asset.Enable(); + } + + public void Disable() + { + asset.Disable(); + } + public IEnumerable bindings => asset.bindings; + + public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false) + { + return asset.FindAction(actionNameOrId, throwIfNotFound); + } + public int FindBinding(InputBinding bindingMask, out InputAction action) + { + return asset.FindBinding(bindingMask, out action); + } + + // Player + private readonly InputActionMap m_Player; + private IPlayerActions m_PlayerActionsCallbackInterface; + private readonly InputAction m_Player_Move; + private readonly InputAction m_Player_Look; + private readonly InputAction m_Player_Click; + public struct PlayerActions + { + private @HandlerControls m_Wrapper; + public PlayerActions(@HandlerControls wrapper) { m_Wrapper = wrapper; } + public InputAction @Move => m_Wrapper.m_Player_Move; + public InputAction @Look => m_Wrapper.m_Player_Look; + public InputAction @Click => m_Wrapper.m_Player_Click; + public InputActionMap Get() { return m_Wrapper.m_Player; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); } + public void SetCallbacks(IPlayerActions instance) + { + if (m_Wrapper.m_PlayerActionsCallbackInterface != null) + { + @Move.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnMove; + @Move.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnMove; + @Move.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnMove; + @Look.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook; + @Look.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook; + @Look.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook; + @Click.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnClick; + @Click.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnClick; + @Click.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnClick; + } + m_Wrapper.m_PlayerActionsCallbackInterface = instance; + if (instance != null) + { + @Move.started += instance.OnMove; + @Move.performed += instance.OnMove; + @Move.canceled += instance.OnMove; + @Look.started += instance.OnLook; + @Look.performed += instance.OnLook; + @Look.canceled += instance.OnLook; + @Click.started += instance.OnClick; + @Click.performed += instance.OnClick; + @Click.canceled += instance.OnClick; + } + } + } + public PlayerActions @Player => new PlayerActions(this); + + // UI + private readonly InputActionMap m_UI; + private IUIActions m_UIActionsCallbackInterface; + private readonly InputAction m_UI_Navigate; + private readonly InputAction m_UI_Submit; + private readonly InputAction m_UI_Cancel; + private readonly InputAction m_UI_Point; + private readonly InputAction m_UI_Click; + private readonly InputAction m_UI_ScrollWheel; + private readonly InputAction m_UI_MiddleClick; + private readonly InputAction m_UI_RightClick; + private readonly InputAction m_UI_TrackedDevicePosition; + private readonly InputAction m_UI_TrackedDeviceOrientation; + public struct UIActions + { + private @HandlerControls m_Wrapper; + public UIActions(@HandlerControls wrapper) { m_Wrapper = wrapper; } + public InputAction @Navigate => m_Wrapper.m_UI_Navigate; + public InputAction @Submit => m_Wrapper.m_UI_Submit; + public InputAction @Cancel => m_Wrapper.m_UI_Cancel; + public InputAction @Point => m_Wrapper.m_UI_Point; + public InputAction @Click => m_Wrapper.m_UI_Click; + public InputAction @ScrollWheel => m_Wrapper.m_UI_ScrollWheel; + public InputAction @MiddleClick => m_Wrapper.m_UI_MiddleClick; + public InputAction @RightClick => m_Wrapper.m_UI_RightClick; + public InputAction @TrackedDevicePosition => m_Wrapper.m_UI_TrackedDevicePosition; + public InputAction @TrackedDeviceOrientation => m_Wrapper.m_UI_TrackedDeviceOrientation; + public InputActionMap Get() { return m_Wrapper.m_UI; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(UIActions set) { return set.Get(); } + public void SetCallbacks(IUIActions instance) + { + if (m_Wrapper.m_UIActionsCallbackInterface != null) + { + @Navigate.started -= m_Wrapper.m_UIActionsCallbackInterface.OnNavigate; + @Navigate.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnNavigate; + @Navigate.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnNavigate; + @Submit.started -= m_Wrapper.m_UIActionsCallbackInterface.OnSubmit; + @Submit.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnSubmit; + @Submit.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnSubmit; + @Cancel.started -= m_Wrapper.m_UIActionsCallbackInterface.OnCancel; + @Cancel.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnCancel; + @Cancel.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnCancel; + @Point.started -= m_Wrapper.m_UIActionsCallbackInterface.OnPoint; + @Point.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnPoint; + @Point.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnPoint; + @Click.started -= m_Wrapper.m_UIActionsCallbackInterface.OnClick; + @Click.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnClick; + @Click.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnClick; + @ScrollWheel.started -= m_Wrapper.m_UIActionsCallbackInterface.OnScrollWheel; + @ScrollWheel.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnScrollWheel; + @ScrollWheel.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnScrollWheel; + @MiddleClick.started -= m_Wrapper.m_UIActionsCallbackInterface.OnMiddleClick; + @MiddleClick.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnMiddleClick; + @MiddleClick.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnMiddleClick; + @RightClick.started -= m_Wrapper.m_UIActionsCallbackInterface.OnRightClick; + @RightClick.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnRightClick; + @RightClick.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnRightClick; + @TrackedDevicePosition.started -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDevicePosition; + @TrackedDevicePosition.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDevicePosition; + @TrackedDevicePosition.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDevicePosition; + @TrackedDeviceOrientation.started -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDeviceOrientation; + @TrackedDeviceOrientation.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDeviceOrientation; + @TrackedDeviceOrientation.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDeviceOrientation; + } + m_Wrapper.m_UIActionsCallbackInterface = instance; + if (instance != null) + { + @Navigate.started += instance.OnNavigate; + @Navigate.performed += instance.OnNavigate; + @Navigate.canceled += instance.OnNavigate; + @Submit.started += instance.OnSubmit; + @Submit.performed += instance.OnSubmit; + @Submit.canceled += instance.OnSubmit; + @Cancel.started += instance.OnCancel; + @Cancel.performed += instance.OnCancel; + @Cancel.canceled += instance.OnCancel; + @Point.started += instance.OnPoint; + @Point.performed += instance.OnPoint; + @Point.canceled += instance.OnPoint; + @Click.started += instance.OnClick; + @Click.performed += instance.OnClick; + @Click.canceled += instance.OnClick; + @ScrollWheel.started += instance.OnScrollWheel; + @ScrollWheel.performed += instance.OnScrollWheel; + @ScrollWheel.canceled += instance.OnScrollWheel; + @MiddleClick.started += instance.OnMiddleClick; + @MiddleClick.performed += instance.OnMiddleClick; + @MiddleClick.canceled += instance.OnMiddleClick; + @RightClick.started += instance.OnRightClick; + @RightClick.performed += instance.OnRightClick; + @RightClick.canceled += instance.OnRightClick; + @TrackedDevicePosition.started += instance.OnTrackedDevicePosition; + @TrackedDevicePosition.performed += instance.OnTrackedDevicePosition; + @TrackedDevicePosition.canceled += instance.OnTrackedDevicePosition; + @TrackedDeviceOrientation.started += instance.OnTrackedDeviceOrientation; + @TrackedDeviceOrientation.performed += instance.OnTrackedDeviceOrientation; + @TrackedDeviceOrientation.canceled += instance.OnTrackedDeviceOrientation; + } + } + } + public UIActions @UI => new UIActions(this); + private int m_KeyboardMouseSchemeIndex = -1; + public InputControlScheme KeyboardMouseScheme + { + get + { + if (m_KeyboardMouseSchemeIndex == -1) m_KeyboardMouseSchemeIndex = asset.FindControlSchemeIndex("Keyboard&Mouse"); + return asset.controlSchemes[m_KeyboardMouseSchemeIndex]; + } + } + private int m_GamepadSchemeIndex = -1; + public InputControlScheme GamepadScheme + { + get + { + if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad"); + return asset.controlSchemes[m_GamepadSchemeIndex]; + } + } + private int m_TouchSchemeIndex = -1; + public InputControlScheme TouchScheme + { + get + { + if (m_TouchSchemeIndex == -1) m_TouchSchemeIndex = asset.FindControlSchemeIndex("Touch"); + return asset.controlSchemes[m_TouchSchemeIndex]; + } + } + private int m_JoystickSchemeIndex = -1; + public InputControlScheme JoystickScheme + { + get + { + if (m_JoystickSchemeIndex == -1) m_JoystickSchemeIndex = asset.FindControlSchemeIndex("Joystick"); + return asset.controlSchemes[m_JoystickSchemeIndex]; + } + } + private int m_XRSchemeIndex = -1; + public InputControlScheme XRScheme + { + get + { + if (m_XRSchemeIndex == -1) m_XRSchemeIndex = asset.FindControlSchemeIndex("XR"); + return asset.controlSchemes[m_XRSchemeIndex]; + } + } + public interface IPlayerActions + { + void OnMove(InputAction.CallbackContext context); + void OnLook(InputAction.CallbackContext context); + void OnClick(InputAction.CallbackContext context); + } + public interface IUIActions + { + void OnNavigate(InputAction.CallbackContext context); + void OnSubmit(InputAction.CallbackContext context); + void OnCancel(InputAction.CallbackContext context); + void OnPoint(InputAction.CallbackContext context); + void OnClick(InputAction.CallbackContext context); + void OnScrollWheel(InputAction.CallbackContext context); + void OnMiddleClick(InputAction.CallbackContext context); + void OnRightClick(InputAction.CallbackContext context); + void OnTrackedDevicePosition(InputAction.CallbackContext context); + void OnTrackedDeviceOrientation(InputAction.CallbackContext context); + } + } +} diff --git a/Assets/InputSystem/HandlerControls.cs.meta b/Assets/InputSystem/HandlerControls.cs.meta new file mode 100644 index 0000000..add1d0c --- /dev/null +++ b/Assets/InputSystem/HandlerControls.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2384c91225c2604da02a052608c9e03 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/InputSystem/AsteroidGame.inputactions b/Assets/InputSystem/HandlerControls.inputactions similarity index 100% rename from Assets/InputSystem/AsteroidGame.inputactions rename to Assets/InputSystem/HandlerControls.inputactions diff --git a/Assets/InputSystem/AsteroidGame.inputactions.meta b/Assets/InputSystem/HandlerControls.inputactions.meta similarity index 84% rename from Assets/InputSystem/AsteroidGame.inputactions.meta rename to Assets/InputSystem/HandlerControls.inputactions.meta index b160f67..51cfdea 100644 --- a/Assets/InputSystem/AsteroidGame.inputactions.meta +++ b/Assets/InputSystem/HandlerControls.inputactions.meta @@ -8,7 +8,7 @@ ScriptedImporter: assetBundleName: assetBundleVariant: script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} - generateWrapperCode: 0 + generateWrapperCode: 1 wrapperCodePath: wrapperClassName: - wrapperCodeNamespace: + wrapperCodeNamespace: AsteroidGame diff --git a/Assets/Scenes/Playground.unity b/Assets/Scenes/Playground.unity index c1518d0..898686b 100644 --- a/Assets/Scenes/Playground.unity +++ b/Assets/Scenes/Playground.unity @@ -123,7 +123,7 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &142965237 +--- !u!1 &38176945 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -131,120 +131,31 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 142965241} - - component: {fileID: 142965240} + - component: {fileID: 38176946} m_Layer: 0 - m_Name: InputSystem + m_Name: Handlers m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &142965240 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 142965237} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Actions: {fileID: -944628639613478452, guid: d126f168386ad6b4986b0d51ca34c3ca, type: 3} - m_NotificationBehavior: 1 - m_UIInputModule: {fileID: 0} - m_DeviceLostEvent: - m_PersistentCalls: - m_Calls: [] - m_DeviceRegainedEvent: - m_PersistentCalls: - m_Calls: [] - m_ControlsChangedEvent: - m_PersistentCalls: - m_Calls: [] - m_ActionEvents: - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 7a6c0190-d56d-4da5-bc75-c47ee4143d4c - m_ActionName: Player/Move[/XInputControllerWindows/leftStick,/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 7a8d4301-f9d3-4c1d-9691-a6080f8ae66f - m_ActionName: Player/Look[/XInputControllerWindows/rightStick,/Mouse/delta] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: c7463e6d-1380-4e73-9edf-f690e3eabd4e - m_ActionName: Player/Click[/XInputControllerWindows/rightTrigger,/Mouse/leftButton] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 20ae2f11-0cff-4b9e-a8bc-9e4991614bbb - m_ActionName: UI/Navigate[/XInputControllerWindows/leftStick/up,/XInputControllerWindows/rightStick/up,/XInputControllerWindows/leftStick/down,/XInputControllerWindows/rightStick/down,/XInputControllerWindows/leftStick/left,/XInputControllerWindows/rightStick/left,/XInputControllerWindows/leftStick/right,/XInputControllerWindows/rightStick/right,/XInputControllerWindows/dpad,/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: a852f158-148f-4764-923f-82ab136e1f9c - m_ActionName: UI/Submit[/Keyboard/enter,/XInputControllerWindows/buttonSouth] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 2c8b2d4b-b9a6-4167-9b1c-c253dfb90ca1 - m_ActionName: UI/Cancel[/Keyboard/escape,/XInputControllerWindows/buttonEast] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: fdeb066f-411a-48b2-9896-9409fee8baf3 - m_ActionName: UI/Point[/Mouse/position] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 05c47259-ced4-4daa-8dc2-9ccf26ff9632 - m_ActionName: UI/Click[/Mouse/leftButton] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 87290d81-61b6-491c-859f-4a1a31f60f1f - m_ActionName: UI/ScrollWheel[/Mouse/scroll] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 97ad60d8-d5db-4a14-8a83-c27358422a2e - m_ActionName: UI/MiddleClick[/Mouse/middleButton] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: fa3293a2-4bbc-4f63-b1e8-aa0a7d75ea96 - m_ActionName: UI/RightClick[/Mouse/rightButton] - - m_PersistentCalls: - m_Calls: [] - m_ActionId: 35072b0b-93e9-4d04-bfe6-5ccaaae85338 - m_ActionName: UI/TrackedDevicePosition - - m_PersistentCalls: - m_Calls: [] - m_ActionId: e0014bd4-6f96-428c-abdb-daf443019be7 - m_ActionName: UI/TrackedDeviceOrientation - m_NeverAutoSwitchControlSchemes: 0 - m_DefaultControlScheme: - m_DefaultActionMap: Player - m_SplitScreenIndex: -1 - m_Camera: {fileID: 0} ---- !u!4 &142965241 +--- !u!4 &38176946 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 142965237} + m_GameObject: {fileID: 38176945} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 436649171} - - {fileID: 1158682046} - {fileID: 1047643964} + - {fileID: 1158682046} m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &436649171 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} - m_PrefabInstance: {fileID: 1191794244} - m_PrefabAsset: {fileID: 0} --- !u!1 &1047643963 GameObject: m_ObjectHideFlags: 0 @@ -274,8 +185,8 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 142965241} - m_RootOrder: 2 + m_Father: {fileID: 38176946} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1047643965 MonoBehaviour: @@ -319,12 +230,12 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1158682045} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 142965241} + m_Father: {fileID: 38176946} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1158682047 @@ -349,7 +260,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 142965241} + m_TransformParent: {fileID: 0} m_Modifications: - target: {fileID: 8083988910661828845, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} propertyPath: m_Name @@ -357,7 +268,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} propertyPath: m_RootOrder - value: 0 + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} + propertyPath: m_LocalRotation.z + value: -0 objectReference: {fileID: 0} - target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -604,7 +527,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3} propertyPath: m_LocalPosition.x