diff --git a/Assets/InputSystem.inputsettings.asset b/Assets/InputSystem.inputsettings.asset new file mode 100644 index 0000000..8a242b0 --- /dev/null +++ b/Assets/InputSystem.inputsettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3} + m_Name: InputSystem.inputsettings + m_EditorClassIdentifier: + m_SupportedDevices: [] + m_UpdateMode: 1 + m_MaxEventBytesPerUpdate: 5242880 + m_MaxQueuedEventsPerUpdate: 1000 + m_CompensateForScreenOrientation: 1 + m_BackgroundBehavior: 0 + m_EditorInputBehaviorInPlayMode: 0 + m_DefaultDeadzoneMin: 0.125 + m_DefaultDeadzoneMax: 0.925 + m_DefaultButtonPressPoint: 0.5 + m_ButtonReleaseThreshold: 0.75 + m_DefaultTapTime: 0.2 + m_DefaultSlowTapTime: 0.5 + m_DefaultHoldTime: 0.4 + m_TapRadius: 5 + m_MultiTapDelayTime: 0.75 + m_DisableRedundantEventsMerging: 0 + m_iOSSettings: + m_MotionUsage: + m_Enabled: 0 + m_Description: diff --git a/Assets/InputSystem.inputsettings.asset.meta b/Assets/InputSystem.inputsettings.asset.meta new file mode 100644 index 0000000..6a6804e --- /dev/null +++ b/Assets/InputSystem.inputsettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 75edf301e04ca6e4e8d030e37fec02e8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Player/Player.prefab b/Assets/Player/Player.prefab index 6edb586..9627373 100644 --- a/Assets/Player/Player.prefab +++ b/Assets/Player/Player.prefab @@ -1001,6 +1001,7 @@ GameObject: - component: {fileID: 9124306867817734687} - component: {fileID: 6340134095258607311} - component: {fileID: -5973425731125482380} + - component: {fileID: 1229072790185042031} m_Layer: 3 m_Name: Player m_TagString: Player @@ -1092,6 +1093,15 @@ MonoBehaviour: m_EditorClassIdentifier: Speed: 12 RotateSpeed: 720 + playerControls: + m_Name: Player Controls + m_Type: 0 + m_ExpectedControlType: + m_Id: a5e4bd49-2a67-4862-9383-e234b2f42aa9 + m_Processors: + m_Interactions: + m_SingletonActionBindings: [] + m_Flags: 0 --- !u!114 &9124306867817734687 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1232,6 +1242,36 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!114 &1229072790185042031 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6949365541298368387} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Actions: {fileID: -944628639613478452, guid: bbacd169367baf64ca79b6a56dad7606, type: 3} + m_NotificationBehavior: 0 + 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_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: Player + m_SplitScreenIndex: -1 + m_Camera: {fileID: 0} --- !u!1 &7075691392410907683 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Player/PlayerControls.cs b/Assets/Player/PlayerControls.cs new file mode 100644 index 0000000..ca524c1 --- /dev/null +++ b/Assets/Player/PlayerControls.cs @@ -0,0 +1,1203 @@ +//------------------------------------------------------------------------------ +// +// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator +// version 1.4.2 +// from Assets/Player/PlayerControls.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; + +public partial class @PlayerControls : IInputActionCollection2, IDisposable +{ + public InputActionAsset asset { get; } + public @PlayerControls() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""PlayerControls"", + ""maps"": [ + { + ""name"": ""Player"", + ""id"": ""c94907a4-722d-4e5b-90c1-2a8fb2df251f"", + ""actions"": [ + { + ""name"": ""Move"", + ""type"": ""Value"", + ""id"": ""007c9044-8622-4f78-942c-c7d731aaade6"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Confirm"", + ""type"": ""Button"", + ""id"": ""947ce93b-5110-474a-a4b3-3550785c86d9"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Escape"", + ""type"": ""Button"", + ""id"": ""621e515f-93cc-4661-a257-c20cad10e503"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Sprint"", + ""type"": ""Button"", + ""id"": ""0c5bca92-4b39-4c27-8ec9-89303977b1a3"", + ""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"": ""PS"", + ""id"": ""79cf9588-8d92-453b-a17e-625ec17c72bf"", + ""path"": ""2DVector"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": true, + ""isPartOfComposite"": false + }, + { + ""name"": ""up"", + ""id"": ""fe808b04-3556-4cd6-a237-3795c1762a7d"", + ""path"": ""/dpad/up"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""down"", + ""id"": ""049ff954-bb2f-484e-91ec-b8ed71a1080f"", + ""path"": ""/dpad/down"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""left"", + ""id"": ""8ce319fe-c07d-4f1e-84ac-c264f11b7779"", + ""path"": ""/dpad/left"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": ""right"", + ""id"": ""2f158004-c3b2-4ca2-b60f-bcb838b037bb"", + ""path"": ""/dpad/right"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Move"", + ""isComposite"": false, + ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""41bccb01-4f12-4085-a11c-20ea00b2bc36"", + ""path"": ""/x"", + ""interactions"": ""Press"", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Confirm"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""a84a6761-ddb2-46ce-84c7-d93b52b29e42"", + ""path"": ""/buttonSouth"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Gamepad"", + ""action"": ""Confirm"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""f6775f2c-ca3f-45c1-9bdd-80e6e80a20c7"", + ""path"": ""/escape"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Escape"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""a3aabba1-e1f5-4b1a-97f6-52596f89c52e"", + ""path"": ""/buttonEast"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Gamepad"", + ""action"": ""Escape"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""1ccd7f0e-31c5-41a4-ad28-20e3aabddd96"", + ""path"": ""/shift"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Sprint"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""28f49a02-d094-435b-9666-691ebeb09a1a"", + ""path"": ""/leftStickPress"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Sprint"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""UI"", + ""id"": ""3f5d1d20-3c1c-4769-86dd-870ef1728c38"", + ""actions"": [ + { + ""name"": ""Navigate"", + ""type"": ""PassThrough"", + ""id"": ""2911e6d4-a31e-4f33-843f-9ad690f00233"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Submit"", + ""type"": ""Button"", + ""id"": ""2cda1a02-5d4e-4a5a-bae7-86221397127c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Cancel"", + ""type"": ""Button"", + ""id"": ""fb5e131d-09b5-46bf-9535-845a3bb14cf1"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Point"", + ""type"": ""PassThrough"", + ""id"": ""723a088c-743f-4ca8-b4fb-e891a6be6c6c"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Click"", + ""type"": ""PassThrough"", + ""id"": ""f1a53f7b-773e-4aef-a3a7-1c772ecbff38"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""ScrollWheel"", + ""type"": ""PassThrough"", + ""id"": ""813a0821-8873-4605-96ce-a06c54d830b7"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""MiddleClick"", + ""type"": ""PassThrough"", + ""id"": ""b0ead1f4-600e-4d32-b4b3-5cc7c264ad4f"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""RightClick"", + ""type"": ""PassThrough"", + ""id"": ""4f52e971-915d-4d49-86a9-d9dde1cc4cb7"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""TrackedDevicePosition"", + ""type"": ""PassThrough"", + ""id"": ""1dc5be4e-eb57-41be-8ecc-0bb582d3a219"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""TrackedDeviceOrientation"", + ""type"": ""PassThrough"", + ""id"": ""14c0c993-c329-45ca-a4d8-c1738ad8c972"", + ""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"": ""Keyboard&Mouse;Gamepad;Touch;Joystick;XR"", + ""action"": ""Submit"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""82627dcc-3b13-4ba9-841d-e4b746d6553e"", + ""path"": ""*/{Cancel}"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse;Gamepad;Touch;Joystick;XR"", + ""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_Confirm = m_Player.FindAction("Confirm", throwIfNotFound: true); + m_Player_Escape = m_Player.FindAction("Escape", throwIfNotFound: true); + m_Player_Sprint = m_Player.FindAction("Sprint", 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_Confirm; + private readonly InputAction m_Player_Escape; + private readonly InputAction m_Player_Sprint; + public struct PlayerActions + { + private @PlayerControls m_Wrapper; + public PlayerActions(@PlayerControls wrapper) { m_Wrapper = wrapper; } + public InputAction @Move => m_Wrapper.m_Player_Move; + public InputAction @Confirm => m_Wrapper.m_Player_Confirm; + public InputAction @Escape => m_Wrapper.m_Player_Escape; + public InputAction @Sprint => m_Wrapper.m_Player_Sprint; + 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; + @Confirm.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnConfirm; + @Confirm.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnConfirm; + @Confirm.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnConfirm; + @Escape.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnEscape; + @Escape.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnEscape; + @Escape.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnEscape; + @Sprint.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSprint; + @Sprint.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSprint; + @Sprint.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSprint; + } + m_Wrapper.m_PlayerActionsCallbackInterface = instance; + if (instance != null) + { + @Move.started += instance.OnMove; + @Move.performed += instance.OnMove; + @Move.canceled += instance.OnMove; + @Confirm.started += instance.OnConfirm; + @Confirm.performed += instance.OnConfirm; + @Confirm.canceled += instance.OnConfirm; + @Escape.started += instance.OnEscape; + @Escape.performed += instance.OnEscape; + @Escape.canceled += instance.OnEscape; + @Sprint.started += instance.OnSprint; + @Sprint.performed += instance.OnSprint; + @Sprint.canceled += instance.OnSprint; + } + } + } + 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 @PlayerControls m_Wrapper; + public UIActions(@PlayerControls 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 OnConfirm(InputAction.CallbackContext context); + void OnEscape(InputAction.CallbackContext context); + void OnSprint(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/Scripts/Input/InputOptions.cs.meta b/Assets/Player/PlayerControls.cs.meta similarity index 83% rename from Assets/Scripts/Input/InputOptions.cs.meta rename to Assets/Player/PlayerControls.cs.meta index 36cf378..78dfd9b 100644 --- a/Assets/Scripts/Input/InputOptions.cs.meta +++ b/Assets/Player/PlayerControls.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 032f3415ba7c171498cf298f0fb45c7e +guid: 0d2697dba749b2343973955799e10a7c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Player/PlayerControls.inputactions b/Assets/Player/PlayerControls.inputactions new file mode 100644 index 0000000..19c1850 --- /dev/null +++ b/Assets/Player/PlayerControls.inputactions @@ -0,0 +1,880 @@ +{ + "name": "PlayerControls", + "maps": [ + { + "name": "Player", + "id": "c94907a4-722d-4e5b-90c1-2a8fb2df251f", + "actions": [ + { + "name": "Move", + "type": "Value", + "id": "007c9044-8622-4f78-942c-c7d731aaade6", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Confirm", + "type": "Button", + "id": "947ce93b-5110-474a-a4b3-3550785c86d9", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Escape", + "type": "Button", + "id": "621e515f-93cc-4661-a257-c20cad10e503", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Sprint", + "type": "Button", + "id": "0c5bca92-4b39-4c27-8ec9-89303977b1a3", + "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": "PS", + "id": "79cf9588-8d92-453b-a17e-625ec17c72bf", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "fe808b04-3556-4cd6-a237-3795c1762a7d", + "path": "/dpad/up", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "049ff954-bb2f-484e-91ec-b8ed71a1080f", + "path": "/dpad/down", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "8ce319fe-c07d-4f1e-84ac-c264f11b7779", + "path": "/dpad/left", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "2f158004-c3b2-4ca2-b60f-bcb838b037bb", + "path": "/dpad/right", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "41bccb01-4f12-4085-a11c-20ea00b2bc36", + "path": "/x", + "interactions": "Press", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Confirm", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "a84a6761-ddb2-46ce-84c7-d93b52b29e42", + "path": "/buttonSouth", + "interactions": "", + "processors": "", + "groups": "Gamepad", + "action": "Confirm", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "f6775f2c-ca3f-45c1-9bdd-80e6e80a20c7", + "path": "/escape", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Escape", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "a3aabba1-e1f5-4b1a-97f6-52596f89c52e", + "path": "/buttonEast", + "interactions": "", + "processors": "", + "groups": "Gamepad", + "action": "Escape", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "1ccd7f0e-31c5-41a4-ad28-20e3aabddd96", + "path": "/shift", + "interactions": "", + "processors": "", + "groups": "", + "action": "Sprint", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "28f49a02-d094-435b-9666-691ebeb09a1a", + "path": "/leftStickPress", + "interactions": "", + "processors": "", + "groups": "", + "action": "Sprint", + "isComposite": false, + "isPartOfComposite": false + } + ] + }, + { + "name": "UI", + "id": "3f5d1d20-3c1c-4769-86dd-870ef1728c38", + "actions": [ + { + "name": "Navigate", + "type": "PassThrough", + "id": "2911e6d4-a31e-4f33-843f-9ad690f00233", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Submit", + "type": "Button", + "id": "2cda1a02-5d4e-4a5a-bae7-86221397127c", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Cancel", + "type": "Button", + "id": "fb5e131d-09b5-46bf-9535-845a3bb14cf1", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Point", + "type": "PassThrough", + "id": "723a088c-743f-4ca8-b4fb-e891a6be6c6c", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Click", + "type": "PassThrough", + "id": "f1a53f7b-773e-4aef-a3a7-1c772ecbff38", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "ScrollWheel", + "type": "PassThrough", + "id": "813a0821-8873-4605-96ce-a06c54d830b7", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "MiddleClick", + "type": "PassThrough", + "id": "b0ead1f4-600e-4d32-b4b3-5cc7c264ad4f", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "RightClick", + "type": "PassThrough", + "id": "4f52e971-915d-4d49-86a9-d9dde1cc4cb7", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "TrackedDevicePosition", + "type": "PassThrough", + "id": "1dc5be4e-eb57-41be-8ecc-0bb582d3a219", + "expectedControlType": "Vector3", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "TrackedDeviceOrientation", + "type": "PassThrough", + "id": "14c0c993-c329-45ca-a4d8-c1738ad8c972", + "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": "Keyboard&Mouse;Gamepad;Touch;Joystick;XR", + "action": "Submit", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "82627dcc-3b13-4ba9-841d-e4b746d6553e", + "path": "*/{Cancel}", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse;Gamepad;Touch;Joystick;XR", + "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 + } + ] + } + ] +} \ No newline at end of file diff --git a/Assets/Player/PlayerControls.inputactions.meta b/Assets/Player/PlayerControls.inputactions.meta new file mode 100644 index 0000000..5a66e02 --- /dev/null +++ b/Assets/Player/PlayerControls.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: bbacd169367baf64ca79b6a56dad7606 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 1 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Assets/Scripts/Dialogue/DialogueManager.cs b/Assets/Scripts/Dialogue/DialogueManager.cs index cf680dd..68d0803 100644 --- a/Assets/Scripts/Dialogue/DialogueManager.cs +++ b/Assets/Scripts/Dialogue/DialogueManager.cs @@ -1,11 +1,11 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using Scampz.GameJam.Assets.Scripts; using Scampz.GameJam.Assets.Scripts.Audio; using Scampz.GameJam.Assets.Scripts.Utilities; using TMPro; using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam { @@ -23,6 +23,9 @@ namespace Scampz.GameJam public bool IsTalking = false; + private InputAction confirmAction; + private InputAction escapeAction; + private void Awake() { if (Instance != null && Instance != this) @@ -36,12 +39,24 @@ namespace Scampz.GameJam public void Start() { + escapeAction = new InputAction("cancel", binding: "/escape"); + escapeAction.AddBinding("/buttonEast"); + escapeAction.Enable(); + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); sentences = new Queue(); } + private void OnDisable() + { + confirmAction.Disable(); + escapeAction.Disable(); + } + private void Update() { - if (IsTalking && Input.GetButtonDown(InputOptions.Cancel)) + if (IsTalking && escapeAction.triggered) EndDialogue(); } @@ -93,7 +108,7 @@ namespace Scampz.GameJam yield return null; SFXManager.Instance.StopSoundEffect(); yield return new WaitForSeconds(0.3f); - yield return new WaitForKeyDown(InputOptions.Submit); + yield return new WaitForKeyDown(confirmAction); SFXManager.Instance.PlaySoundEffect(SoundEffectName.Ok); DisplayNextSentence(dialogue); } diff --git a/Assets/Scripts/Dialogue/PromptDialogue.cs b/Assets/Scripts/Dialogue/PromptDialogue.cs index 8f19b20..e361333 100644 --- a/Assets/Scripts/Dialogue/PromptDialogue.cs +++ b/Assets/Scripts/Dialogue/PromptDialogue.cs @@ -1,5 +1,5 @@ -using Scampz.GameJam.Assets.Scripts; using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam { @@ -10,6 +10,20 @@ namespace Scampz.GameJam private bool _isWithinRange = false; + private InputAction confirmAction; + + void Start() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + + private void OnDisable() + { + confirmAction.Disable(); + } + private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) @@ -24,7 +38,7 @@ namespace Scampz.GameJam private void Update() { - if (_isWithinRange && Input.GetButtonDown(InputOptions.Submit) && !DialogueManager.Instance.IsTalking) + if (_isWithinRange && confirmAction.triggered && !DialogueManager.Instance.IsTalking) { var player = GameObject.FindGameObjectWithTag("Player"); var cc = player.GetComponent(); diff --git a/Assets/Scripts/Input/CharacterInputController.cs b/Assets/Scripts/Input/CharacterInputController.cs index a133f02..12cd43e 100644 --- a/Assets/Scripts/Input/CharacterInputController.cs +++ b/Assets/Scripts/Input/CharacterInputController.cs @@ -1,5 +1,6 @@ using Scampz.GameJam.Assets.Scripts.Player; using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam.Assets.Scripts { @@ -10,6 +11,28 @@ namespace Scampz.GameJam.Assets.Scripts public float RotateSpeed = 720.0f; private float _ySpeed = 0f; private PlayerState _playerState; + public PlayerControls playerControls; + private InputAction move; + private InputAction sprint; + + private void Awake() + { + playerControls = new PlayerControls(); + } + + private void OnEnable() + { + move = playerControls.Player.Move; + sprint = playerControls.Player.Sprint; + move.Enable(); + sprint.Enable(); + } + + private void OnDisable() + { + move.Disable(); + sprint.Disable(); + } private void Start() { @@ -25,12 +48,10 @@ namespace Scampz.GameJam.Assets.Scripts void Move() { var movementSpeed = Speed; - if (Input.GetButton(InputOptions.Sprint)) + if (sprint.IsPressed()) movementSpeed *= 2; - var horizontalMovement = Input.GetAxisRaw(InputOptions.Horizontal); - var verticalMovement = Input.GetAxisRaw(InputOptions.Vertical); - - var movementDirection = new Vector3(-horizontalMovement, 0, -verticalMovement); + var movement = move.ReadValue(); + var movementDirection = new Vector3(-movement.x, 0, -movement.y); var magnitude = Mathf.Clamp01(movementDirection.magnitude) * movementSpeed; movementDirection.Normalize(); _ySpeed += Physics.gravity.y * Time.deltaTime; diff --git a/Assets/Scripts/Input/InputOptions.cs b/Assets/Scripts/Input/InputOptions.cs deleted file mode 100644 index e562a0e..0000000 --- a/Assets/Scripts/Input/InputOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Scampz.GameJam.Assets.Scripts -{ - public static class InputOptions - { - public static string Vertical => "Vertical"; - - public static string Horizontal => "Horizontal"; - - public static string Submit => "Submit"; - - public static string Cancel => "Cancel"; - - public static string Sprint => "Sprint"; - } -} diff --git a/Assets/Scripts/Player/TalkedToAirshipGuy.cs b/Assets/Scripts/Player/TalkedToAirshipGuy.cs index dc0408b..8c5a410 100644 --- a/Assets/Scripts/Player/TalkedToAirshipGuy.cs +++ b/Assets/Scripts/Player/TalkedToAirshipGuy.cs @@ -1,12 +1,27 @@ using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam.Assets.Scripts.Player { public class TalkedToAirshipGuy : MonoBehaviour { + private InputAction confirmAction; + + void OnEnable() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + + void OnDisable() + { + confirmAction.Disable(); + } + public void OnTriggerStay(Collider other) { - if (Input.GetButton(InputOptions.Submit)) + if (confirmAction.triggered) UnlockSanctumState.Instance.TalkedToAirshipGuy = true; } } diff --git a/Assets/Scripts/Player/TalkedToFrogLady.cs b/Assets/Scripts/Player/TalkedToFrogLady.cs index d257f94..f3e21e0 100644 --- a/Assets/Scripts/Player/TalkedToFrogLady.cs +++ b/Assets/Scripts/Player/TalkedToFrogLady.cs @@ -1,12 +1,27 @@ using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam.Assets.Scripts.Player { public class TalkedToFrogLady : MonoBehaviour { + private InputAction confirmAction; + + void OnEnable() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + + void OnDisable() + { + confirmAction.Disable(); + } + public void OnTriggerStay(Collider other) { - if (Input.GetButton(InputOptions.Submit)) + if (confirmAction.triggered) UnlockSanctumState.Instance.TalkedToFrog = true; } } diff --git a/Assets/Scripts/Player/TalkedToIceGuy.cs b/Assets/Scripts/Player/TalkedToIceGuy.cs index 922ac85..0cf80cc 100644 --- a/Assets/Scripts/Player/TalkedToIceGuy.cs +++ b/Assets/Scripts/Player/TalkedToIceGuy.cs @@ -1,12 +1,27 @@ using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam.Assets.Scripts.Player { public class TalkedToIceGuy : MonoBehaviour { + private InputAction confirmAction; + + void Start() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + + private void OnDisable() + { + confirmAction.Disable(); + } + public void OnTriggerStay(Collider other) { - if (Input.GetButton(InputOptions.Submit)) + if (confirmAction.triggered) UnlockSanctumState.Instance.TalkedToIceGuy = true; } } diff --git a/Assets/Scripts/Player/TalkedToVoid.cs b/Assets/Scripts/Player/TalkedToVoid.cs index 78b3f75..a606baf 100644 --- a/Assets/Scripts/Player/TalkedToVoid.cs +++ b/Assets/Scripts/Player/TalkedToVoid.cs @@ -1,16 +1,28 @@ using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam.Assets.Scripts.Player { public class TalkedToVoid : MonoBehaviour { + private InputAction confirmAction; + + void Start() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + + private void OnDisable() + { + confirmAction.Disable(); + } + public void OnTriggerStay(Collider other) { - if (other.CompareTag("Player")) - { - if (Input.GetButton(InputOptions.Submit)) - UnlockSanctumState.Instance.VoidOpened = true; - } + if (confirmAction.triggered) + UnlockSanctumState.Instance.VoidOpened = true; } } } diff --git a/Assets/Scripts/SceneManagement/LoadScene.cs b/Assets/Scripts/SceneManagement/LoadScene.cs index 8a2ba92..fd41577 100644 --- a/Assets/Scripts/SceneManagement/LoadScene.cs +++ b/Assets/Scripts/SceneManagement/LoadScene.cs @@ -1,7 +1,7 @@ -using Scampz.GameJam.Assets.Scripts; using Scampz.GameJam.Assets.Scripts.Audio; using TMPro; using UnityEngine; +using UnityEngine.InputSystem; using UnityEngine.SceneManagement; namespace Scampz.GameJam @@ -16,6 +16,20 @@ namespace Scampz.GameJam [SerializeField] private TextMeshProUGUI _promptText; + private InputAction confirmAction; + + void Start() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + + private void OnDisable() + { + confirmAction.Disable(); + } + void OnTriggerEnter(Collider collider) { if (!_loaded && collider.CompareTag("Player")) @@ -30,7 +44,7 @@ namespace Scampz.GameJam private void OnTriggerStay(Collider collider) { - if (!_loaded && collider.CompareTag("Player") && _promptText != null && _promptText.enabled && Input.GetButton(InputOptions.Submit)) + if (!_loaded && collider.CompareTag("Player") && _promptText != null && _promptText.enabled && confirmAction.IsPressed()) LoadNextLevel(); } diff --git a/Assets/Scripts/TitleScreen/TitleScreen.cs b/Assets/Scripts/TitleScreen/TitleScreen.cs index 660819e..16be05d 100644 --- a/Assets/Scripts/TitleScreen/TitleScreen.cs +++ b/Assets/Scripts/TitleScreen/TitleScreen.cs @@ -1,14 +1,24 @@ using Scampz.GameJam.Assets.Scripts; using UnityEngine; +using UnityEngine.InputSystem; using UnityEngine.SceneManagement; namespace Scampz.GameJam { public class TitleScreen : MonoBehaviour { + private InputAction confirmAction; + + void Start() + { + confirmAction = new InputAction("confirm", binding: "/x"); + confirmAction.AddBinding("/buttonSouth"); + confirmAction.Enable(); + } + void Update() { - if (Input.GetButton(InputOptions.Submit)) + if (confirmAction.triggered) GameManager.Instance.LoadScene(SceneNames.WorldMap, LoadSceneMode.Single); } } diff --git a/Assets/Scripts/Utilities/WaitForKeyDown.cs b/Assets/Scripts/Utilities/WaitForKeyDown.cs index af8d813..b139fd6 100644 --- a/Assets/Scripts/Utilities/WaitForKeyDown.cs +++ b/Assets/Scripts/Utilities/WaitForKeyDown.cs @@ -1,29 +1,22 @@ -using System.Collections.Generic; -using System.Linq; -using UnityEngine; +using UnityEngine; +using UnityEngine.InputSystem; namespace Scampz.GameJam.Assets.Scripts.Utilities { public class WaitForKeyDown : CustomYieldInstruction { - private List _inputOptions; + private InputAction _inputAction; public override bool keepWaiting => !ShouldContinue(); - public WaitForKeyDown(params string[] inputOptions) + public WaitForKeyDown(InputAction inputAction) { - _inputOptions = inputOptions.ToList(); + _inputAction = inputAction; } private bool ShouldContinue() { - foreach (var input in _inputOptions) - { - if (Input.GetButtonDown(input)) - return true; - } - - return false; + return _inputAction.triggered; } } } diff --git a/Assets/Singleton/SingletonManager.prefab b/Assets/Singleton/SingletonManager.prefab index 1cf8f9f..30f6123 100644 --- a/Assets/Singleton/SingletonManager.prefab +++ b/Assets/Singleton/SingletonManager.prefab @@ -292,7 +292,6 @@ RectTransform: - {fileID: 8787990294269674328} - {fileID: 2892224927131087056} - {fileID: 9048025182165106366} - - {fileID: 8261970056456307927} - {fileID: 5230657984148141075} m_Father: {fileID: 3584299649024768172} m_RootOrder: 3 @@ -383,74 +382,6 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!1 &3027751379730255851 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 8261970056456307927} - - component: {fileID: 1741723130925857036} - - component: {fileID: 1314157284691256634} - m_Layer: 5 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &8261970056456307927 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3027751379730255851} - 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: 4605870207825934367} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1741723130925857036 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3027751379730255851} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!114 &1314157284691256634 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3027751379730255851} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_SendPointerHoverToParent: 1 - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 --- !u!1 &3584299648992395873 GameObject: m_ObjectHideFlags: 0 @@ -1129,7 +1060,7 @@ RectTransform: m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 4605870207825934367} - m_RootOrder: 4 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} diff --git a/Packages/manifest.json b/Packages/manifest.json index 9fa83fa..7e8455a 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -7,6 +7,7 @@ "com.unity.ide.rider": "3.0.15", "com.unity.ide.visualstudio": "2.0.16", "com.unity.ide.vscode": "1.2.5", + "com.unity.inputsystem": "1.3.0", "com.unity.postprocessing": "2.2.2", "com.unity.test-framework": "1.1.31", "com.unity.textmeshpro": "3.0.6", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index fedd6a0..605ef52 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -69,6 +69,15 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.inputsystem": { + "version": "1.3.0", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.uielements": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.nuget.newtonsoft-json": { "version": "3.0.2", "depth": 2, diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index cd77760..ef82864 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -23,4 +23,5 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/Cease.unity guid: 5f3b640cf11bb294c8643daf68fd5e52 - m_configObjects: {} + m_configObjects: + com.unity.input.settings: {fileID: 11400000, guid: 75edf301e04ca6e4e8d030e37fec02e8, type: 2} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9fb0cfb..7770577 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -76,7 +76,7 @@ PlayerSettings: androidFullscreenMode: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 - runInBackground: 1 + runInBackground: 0 captureSingleScreen: 0 muteOtherAudioSources: 0 Prepare IOS For Recording: 0 @@ -98,8 +98,8 @@ PlayerSettings: xboxEnableKinectAutoTracking: 0 xboxEnableFitness: 0 visibleInBackground: 1 - allowFullscreenSwitch: 1 - fullscreenMode: 1 + allowFullscreenSwitch: 0 + fullscreenMode: 0 xboxSpeechDB: 0 xboxEnableHeadOrientation: 0 xboxEnableGuest: 0 @@ -135,7 +135,8 @@ PlayerSettings: 16:9: 1 Others: 1 bundleVersion: 0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 0} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1 @@ -154,7 +155,8 @@ PlayerSettings: resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 - applicationIdentifier: {} + applicationIdentifier: + Standalone: com.Scampz.Cease buildNumber: Standalone: 0 iPhone: 0 @@ -809,7 +811,7 @@ PlayerSettings: m_VersionCode: 1 m_VersionName: apiCompatibilityLevel: 6 - activeInputHandler: 0 + activeInputHandler: 1 cloudProjectId: framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] diff --git a/README.md b/README.md deleted file mode 100644 index 4e58067..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Scampz -