From 44e13f4837bc6a5a96fd99e75b17295d759932d4 Mon Sep 17 00:00:00 2001 From: htom Date: Tue, 24 Feb 2026 09:33:08 +0100 Subject: [PATCH] feat: rotate the player camera to the side with the mouse --- Assets/Input/InputMaster.cs | 1505 +++++++++++++++++ Assets/Input/InputMaster.cs.meta | 11 + ....inputactions => InputMaster.inputactions} | 14 +- ...ons.meta => InputMaster.inputactions.meta} | 2 +- Assets/Mat.mat | 83 + Assets/Mat.mat.meta | 8 + Assets/Player.mat | 83 + Assets/Player.mat.meta | 8 + Assets/Scenes/Game.unity | 144 +- Assets/Scripts/PlayerMovement.cs | 18 +- 10 files changed, 1849 insertions(+), 27 deletions(-) create mode 100644 Assets/Input/InputMaster.cs create mode 100644 Assets/Input/InputMaster.cs.meta rename Assets/Input/{OMG.inputactions => InputMaster.inputactions} (99%) rename Assets/Input/{OMG.inputactions.meta => InputMaster.inputactions.meta} (93%) create mode 100644 Assets/Mat.mat create mode 100644 Assets/Mat.mat.meta create mode 100644 Assets/Player.mat create mode 100644 Assets/Player.mat.meta diff --git a/Assets/Input/InputMaster.cs b/Assets/Input/InputMaster.cs new file mode 100644 index 00000000..db4fd6b9 --- /dev/null +++ b/Assets/Input/InputMaster.cs @@ -0,0 +1,1505 @@ +//------------------------------------------------------------------------------ +// +// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator +// version 1.14.2 +// from Assets/Input/InputMaster.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; + +/// +/// Provides programmatic access to , , and instances defined in asset "Assets/Input/InputMaster.inputactions". +/// +/// +/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified. +/// +/// +/// +/// using namespace UnityEngine; +/// using UnityEngine.InputSystem; +/// +/// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface. +/// public class Example : MonoBehaviour, MyActions.IPlayerActions +/// { +/// private MyActions_Actions m_Actions; // Source code representation of asset. +/// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map. +/// +/// void Awake() +/// { +/// m_Actions = new MyActions_Actions(); // Create asset object. +/// m_Player = m_Actions.Player; // Extract action map object. +/// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions. +/// } +/// +/// void OnDestroy() +/// { +/// m_Actions.Dispose(); // Destroy asset object. +/// } +/// +/// void OnEnable() +/// { +/// m_Player.Enable(); // Enable all actions within map. +/// } +/// +/// void OnDisable() +/// { +/// m_Player.Disable(); // Disable all actions within map. +/// } +/// +/// #region Interface implementation of MyActions.IPlayerActions +/// +/// // Invoked when "Move" action is either started, performed or canceled. +/// public void OnMove(InputAction.CallbackContext context) +/// { +/// Debug.Log($"OnMove: {context.ReadValue<Vector2>()}"); +/// } +/// +/// // Invoked when "Attack" action is either started, performed or canceled. +/// public void OnAttack(InputAction.CallbackContext context) +/// { +/// Debug.Log($"OnAttack: {context.ReadValue<float>()}"); +/// } +/// +/// #endregion +/// } +/// +/// +public partial class @InputMaster: IInputActionCollection2, IDisposable +{ + /// + /// Provides access to the underlying asset instance. + /// + public InputActionAsset asset { get; } + + /// + /// Constructs a new instance. + /// + public @InputMaster() + { + asset = InputActionAsset.FromJson(@"{ + ""version"": 1, + ""name"": ""InputMaster"", + ""maps"": [ + { + ""name"": ""Player"", + ""id"": ""ba06b8b3-5539-468c-958d-a3322ba6ed6f"", + ""actions"": [ + { + ""name"": ""Move"", + ""type"": ""Value"", + ""id"": ""2dd47368-316b-470b-ad53-28fc2926c0ec"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Look"", + ""type"": ""Value"", + ""id"": ""1092b3c1-6dbc-4506-9984-54eb43981894"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Fire"", + ""type"": ""Button"", + ""id"": ""a3cbeaa5-c874-4ac6-86e7-93bedb48c66e"", + ""expectedControlType"": """", + ""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"": ""3e5f5442-8668-4b27-a940-df99bad7e831"", + ""path"": ""/{Hatswitch}"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Look"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""79d18aab-c726-4645-8a8b-f39d1e96e67e"", + ""path"": ""/delta"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Look"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""143bb1cd-cc10-4eca-a2f0-a3664166fe91"", + ""path"": ""/rightTrigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Gamepad"", + ""action"": ""Fire"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""05f6913d-c316-48b2-a6bb-e225f14c7960"", + ""path"": ""/leftButton"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Keyboard&Mouse"", + ""action"": ""Fire"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""886e731e-7071-4ae4-95c0-e61739dad6fd"", + ""path"": ""/primaryTouch/tap"", + ""interactions"": """", + ""processors"": """", + ""groups"": "";Touch"", + ""action"": ""Fire"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""ee3d0cd2-254e-47a7-a8cb-bc94d9658c54"", + ""path"": ""/trigger"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Joystick"", + ""action"": ""Fire"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8255d333-5683-4943-a58a-ccb207ff1dce"", + ""path"": ""/{PrimaryAction}"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""XR"", + ""action"": ""Fire"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + }, + { + ""name"": ""UI"", + ""id"": ""390a4f8a-91ef-4af0-8d04-c728af1580ad"", + ""actions"": [ + { + ""name"": ""Navigate"", + ""type"": ""PassThrough"", + ""id"": ""5f8df7e3-7343-42ad-b1ae-6f976b192d8d"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Submit"", + ""type"": ""Button"", + ""id"": ""2995d160-a592-478a-8ca1-9070c808f051"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Cancel"", + ""type"": ""Button"", + ""id"": ""7e963dc0-9999-45a0-8a05-d1d71b404a75"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Point"", + ""type"": ""PassThrough"", + ""id"": ""bafd5bbd-b1ea-4f63-a9c9-0a62d97a70fd"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""Click"", + ""type"": ""PassThrough"", + ""id"": ""70695a11-53df-4bf3-bdd9-8a39c3f0b3dc"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": true + }, + { + ""name"": ""ScrollWheel"", + ""type"": ""PassThrough"", + ""id"": ""750f8c28-ff74-411c-beb6-f287e9fc1c08"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""MiddleClick"", + ""type"": ""PassThrough"", + ""id"": ""8ac55450-5398-4d2c-9505-fa006ae523b6"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""RightClick"", + ""type"": ""PassThrough"", + ""id"": ""9435c3db-4317-4b59-9fbe-b6e8cb614c1e"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""TrackedDevicePosition"", + ""type"": ""PassThrough"", + ""id"": ""e46670cf-ab81-4530-af4e-646ff552a0d7"", + ""expectedControlType"": ""Vector3"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""TrackedDeviceOrientation"", + ""type"": ""PassThrough"", + ""id"": ""6e0ae25a-6a8d-496d-976f-5b53f4787f9a"", + ""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_Look = m_Player.FindAction("Look", throwIfNotFound: true); + m_Player_Fire = m_Player.FindAction("Fire", 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); + } + + ~@InputMaster() + { + UnityEngine.Debug.Assert(!m_Player.enabled, "This will cause a leak and performance issues, InputMaster.Player.Disable() has not been called."); + UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, InputMaster.UI.Disable() has not been called."); + } + + /// + /// Destroys this asset and all associated instances. + /// + 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 List m_PlayerActionsCallbackInterfaces = new List(); + private readonly InputAction m_Player_Move; + private readonly InputAction m_Player_Look; + private readonly InputAction m_Player_Fire; + /// + /// Provides access to input actions defined in input action map "Player". + /// + public struct PlayerActions + { + private @InputMaster m_Wrapper; + + /// + /// Construct a new instance of the input action map wrapper class. + /// + public PlayerActions(@InputMaster wrapper) { m_Wrapper = wrapper; } + /// + /// Provides access to the underlying input action "Player/Move". + /// + public InputAction @Move => m_Wrapper.m_Player_Move; + /// + /// Provides access to the underlying input action "Player/Look". + /// + public InputAction @Look => m_Wrapper.m_Player_Look; + /// + /// Provides access to the underlying input action "Player/Fire". + /// + public InputAction @Fire => m_Wrapper.m_Player_Fire; + /// + /// Provides access to the underlying input action map instance. + /// + public InputActionMap Get() { return m_Wrapper.m_Player; } + /// + public void Enable() { Get().Enable(); } + /// + public void Disable() { Get().Disable(); } + /// + public bool enabled => Get().enabled; + /// + /// Implicitly converts an to an instance. + /// + public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); } + /// + /// Adds , and callbacks provided via on all input actions contained in this map. + /// + /// Callback instance. + /// + /// If is null or have already been added this method does nothing. + /// + /// + public void AddCallbacks(IPlayerActions instance) + { + if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance); + @Move.started += instance.OnMove; + @Move.performed += instance.OnMove; + @Move.canceled += instance.OnMove; + @Look.started += instance.OnLook; + @Look.performed += instance.OnLook; + @Look.canceled += instance.OnLook; + @Fire.started += instance.OnFire; + @Fire.performed += instance.OnFire; + @Fire.canceled += instance.OnFire; + } + + /// + /// Removes , and callbacks provided via on all input actions contained in this map. + /// + /// + /// Calling this method when have not previously been registered has no side-effects. + /// + /// + private void UnregisterCallbacks(IPlayerActions instance) + { + @Move.started -= instance.OnMove; + @Move.performed -= instance.OnMove; + @Move.canceled -= instance.OnMove; + @Look.started -= instance.OnLook; + @Look.performed -= instance.OnLook; + @Look.canceled -= instance.OnLook; + @Fire.started -= instance.OnFire; + @Fire.performed -= instance.OnFire; + @Fire.canceled -= instance.OnFire; + } + + /// + /// Unregisters and unregisters all input action callbacks via . + /// + /// + public void RemoveCallbacks(IPlayerActions instance) + { + if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + /// + /// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via . + /// + /// + /// If is null, calling this method will only unregister all existing callbacks but not register any new callbacks. + /// + /// + /// + /// + public void SetCallbacks(IPlayerActions instance) + { + foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + /// + /// Provides a new instance referencing this action map. + /// + public PlayerActions @Player => new PlayerActions(this); + + // UI + private readonly InputActionMap m_UI; + private List m_UIActionsCallbackInterfaces = new List(); + 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; + /// + /// Provides access to input actions defined in input action map "UI". + /// + public struct UIActions + { + private @InputMaster m_Wrapper; + + /// + /// Construct a new instance of the input action map wrapper class. + /// + public UIActions(@InputMaster wrapper) { m_Wrapper = wrapper; } + /// + /// Provides access to the underlying input action "UI/Navigate". + /// + public InputAction @Navigate => m_Wrapper.m_UI_Navigate; + /// + /// Provides access to the underlying input action "UI/Submit". + /// + public InputAction @Submit => m_Wrapper.m_UI_Submit; + /// + /// Provides access to the underlying input action "UI/Cancel". + /// + public InputAction @Cancel => m_Wrapper.m_UI_Cancel; + /// + /// Provides access to the underlying input action "UI/Point". + /// + public InputAction @Point => m_Wrapper.m_UI_Point; + /// + /// Provides access to the underlying input action "UI/Click". + /// + public InputAction @Click => m_Wrapper.m_UI_Click; + /// + /// Provides access to the underlying input action "UI/ScrollWheel". + /// + public InputAction @ScrollWheel => m_Wrapper.m_UI_ScrollWheel; + /// + /// Provides access to the underlying input action "UI/MiddleClick". + /// + public InputAction @MiddleClick => m_Wrapper.m_UI_MiddleClick; + /// + /// Provides access to the underlying input action "UI/RightClick". + /// + public InputAction @RightClick => m_Wrapper.m_UI_RightClick; + /// + /// Provides access to the underlying input action "UI/TrackedDevicePosition". + /// + public InputAction @TrackedDevicePosition => m_Wrapper.m_UI_TrackedDevicePosition; + /// + /// Provides access to the underlying input action "UI/TrackedDeviceOrientation". + /// + public InputAction @TrackedDeviceOrientation => m_Wrapper.m_UI_TrackedDeviceOrientation; + /// + /// Provides access to the underlying input action map instance. + /// + public InputActionMap Get() { return m_Wrapper.m_UI; } + /// + public void Enable() { Get().Enable(); } + /// + public void Disable() { Get().Disable(); } + /// + public bool enabled => Get().enabled; + /// + /// Implicitly converts an to an instance. + /// + public static implicit operator InputActionMap(UIActions set) { return set.Get(); } + /// + /// Adds , and callbacks provided via on all input actions contained in this map. + /// + /// Callback instance. + /// + /// If is null or have already been added this method does nothing. + /// + /// + public void AddCallbacks(IUIActions instance) + { + if (instance == null || m_Wrapper.m_UIActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_UIActionsCallbackInterfaces.Add(instance); + @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; + } + + /// + /// Removes , and callbacks provided via on all input actions contained in this map. + /// + /// + /// Calling this method when have not previously been registered has no side-effects. + /// + /// + private void UnregisterCallbacks(IUIActions instance) + { + @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; + } + + /// + /// Unregisters and unregisters all input action callbacks via . + /// + /// + public void RemoveCallbacks(IUIActions instance) + { + if (m_Wrapper.m_UIActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + /// + /// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via . + /// + /// + /// If is null, calling this method will only unregister all existing callbacks but not register any new callbacks. + /// + /// + /// + /// + public void SetCallbacks(IUIActions instance) + { + foreach (var item in m_Wrapper.m_UIActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_UIActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + /// + /// Provides a new instance referencing this action map. + /// + public UIActions @UI => new UIActions(this); + private int m_KeyboardMouseSchemeIndex = -1; + /// + /// Provides access to the input control scheme. + /// + /// + public InputControlScheme KeyboardMouseScheme + { + get + { + if (m_KeyboardMouseSchemeIndex == -1) m_KeyboardMouseSchemeIndex = asset.FindControlSchemeIndex("Keyboard&Mouse"); + return asset.controlSchemes[m_KeyboardMouseSchemeIndex]; + } + } + private int m_GamepadSchemeIndex = -1; + /// + /// Provides access to the input control scheme. + /// + /// + public InputControlScheme GamepadScheme + { + get + { + if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad"); + return asset.controlSchemes[m_GamepadSchemeIndex]; + } + } + private int m_TouchSchemeIndex = -1; + /// + /// Provides access to the input control scheme. + /// + /// + public InputControlScheme TouchScheme + { + get + { + if (m_TouchSchemeIndex == -1) m_TouchSchemeIndex = asset.FindControlSchemeIndex("Touch"); + return asset.controlSchemes[m_TouchSchemeIndex]; + } + } + private int m_JoystickSchemeIndex = -1; + /// + /// Provides access to the input control scheme. + /// + /// + public InputControlScheme JoystickScheme + { + get + { + if (m_JoystickSchemeIndex == -1) m_JoystickSchemeIndex = asset.FindControlSchemeIndex("Joystick"); + return asset.controlSchemes[m_JoystickSchemeIndex]; + } + } + private int m_XRSchemeIndex = -1; + /// + /// Provides access to the input control scheme. + /// + /// + public InputControlScheme XRScheme + { + get + { + if (m_XRSchemeIndex == -1) m_XRSchemeIndex = asset.FindControlSchemeIndex("XR"); + return asset.controlSchemes[m_XRSchemeIndex]; + } + } + /// + /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Player" which allows adding and removing callbacks. + /// + /// + /// + public interface IPlayerActions + { + /// + /// Method invoked when associated input action "Move" is either , or . + /// + /// + /// + /// + void OnMove(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Look" is either , or . + /// + /// + /// + /// + void OnLook(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Fire" is either , or . + /// + /// + /// + /// + void OnFire(InputAction.CallbackContext context); + } + /// + /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks. + /// + /// + /// + public interface IUIActions + { + /// + /// Method invoked when associated input action "Navigate" is either , or . + /// + /// + /// + /// + void OnNavigate(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Submit" is either , or . + /// + /// + /// + /// + void OnSubmit(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Cancel" is either , or . + /// + /// + /// + /// + void OnCancel(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Point" is either , or . + /// + /// + /// + /// + void OnPoint(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Click" is either , or . + /// + /// + /// + /// + void OnClick(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "ScrollWheel" is either , or . + /// + /// + /// + /// + void OnScrollWheel(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "MiddleClick" is either , or . + /// + /// + /// + /// + void OnMiddleClick(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "RightClick" is either , or . + /// + /// + /// + /// + void OnRightClick(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "TrackedDevicePosition" is either , or . + /// + /// + /// + /// + void OnTrackedDevicePosition(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "TrackedDeviceOrientation" is either , or . + /// + /// + /// + /// + void OnTrackedDeviceOrientation(InputAction.CallbackContext context); + } +} diff --git a/Assets/Input/InputMaster.cs.meta b/Assets/Input/InputMaster.cs.meta new file mode 100644 index 00000000..ea0b1506 --- /dev/null +++ b/Assets/Input/InputMaster.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb780d6a79f8f46ce8ed37b6cf73dbbb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Input/OMG.inputactions b/Assets/Input/InputMaster.inputactions similarity index 99% rename from Assets/Input/OMG.inputactions rename to Assets/Input/InputMaster.inputactions index 55663270..c6309e55 100644 --- a/Assets/Input/OMG.inputactions +++ b/Assets/Input/InputMaster.inputactions @@ -1,6 +1,6 @@ { "version": 1, - "name": "OMG", + "name": "InputMaster", "maps": [ { "name": "Player", @@ -180,22 +180,22 @@ }, { "name": "", - "id": "8c8e490b-c610-4785-884f-f04217b23ca4", - "path": "/delta", + "id": "3e5f5442-8668-4b27-a940-df99bad7e831", + "path": "/{Hatswitch}", "interactions": "", "processors": "", - "groups": ";Keyboard&Mouse;Touch", + "groups": "Joystick", "action": "Look", "isComposite": false, "isPartOfComposite": false }, { "name": "", - "id": "3e5f5442-8668-4b27-a940-df99bad7e831", - "path": "/{Hatswitch}", + "id": "79d18aab-c726-4645-8a8b-f39d1e96e67e", + "path": "/delta", "interactions": "", "processors": "", - "groups": "Joystick", + "groups": "", "action": "Look", "isComposite": false, "isPartOfComposite": false diff --git a/Assets/Input/OMG.inputactions.meta b/Assets/Input/InputMaster.inputactions.meta similarity index 93% rename from Assets/Input/OMG.inputactions.meta rename to Assets/Input/InputMaster.inputactions.meta index 11151d1a..ba26e2a4 100644 --- a/Assets/Input/OMG.inputactions.meta +++ b/Assets/Input/InputMaster.inputactions.meta @@ -8,7 +8,7 @@ ScriptedImporter: assetBundleName: assetBundleVariant: script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} - generateWrapperCode: 0 + generateWrapperCode: 1 wrapperCodePath: wrapperClassName: wrapperCodeNamespace: diff --git a/Assets/Mat.mat b/Assets/Mat.mat new file mode 100644 index 00000000..3f94f948 --- /dev/null +++ b/Assets/Mat.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Mat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 0.20736837, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Mat.mat.meta b/Assets/Mat.mat.meta new file mode 100644 index 00000000..f3014791 --- /dev/null +++ b/Assets/Mat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e083d038de05807b8251393125f9200 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Player.mat b/Assets/Player.mat new file mode 100644 index 00000000..283d4a20 --- /dev/null +++ b/Assets/Player.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Player + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Player.mat.meta b/Assets/Player.mat.meta new file mode 100644 index 00000000..0f487f8b --- /dev/null +++ b/Assets/Player.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 55ecce37ebb44f3e7ab364e7c831da79 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Game.unity b/Assets/Scenes/Game.unity index 81596b8b..bd3a2240 100644 --- a/Assets/Scenes/Game.unity +++ b/Assets/Scenes/Game.unity @@ -208,11 +208,116 @@ Transform: m_GameObject: {fileID: 125070999} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalPosition: {x: 0, y: 0.76, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 0} + m_Father: {fileID: 1680796422} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &420667094 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 420667098} + - component: {fileID: 420667097} + - component: {fileID: 420667096} + - component: {fileID: 420667095} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &420667095 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420667094} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &420667096 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420667094} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 4e083d038de05807b8251393125f9200, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &420667097 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420667094} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &420667098 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420667094} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.3796791, y: 2.94, z: -0.35401067} + m_LocalScale: {x: 0.013368983, y: 4.7461, z: 0.013368983} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 463387416} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &463387412 GameObject: @@ -314,9 +419,10 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 20, y: 1, z: 20} + m_LocalScale: {x: 74.8, y: 1, z: 74.8} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 420667098} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &574677457 @@ -478,7 +584,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 2100000, guid: 55ecce37ebb44f3e7ab364e7c831da79, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -516,13 +622,14 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1680796418} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1.52, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalRotation: {x: 0, y: -0.80701184, z: 0, w: 0.59053534} + m_LocalPosition: {x: 0, y: 2.23, z: 0} + m_LocalScale: {x: 1.2, y: 1.8, z: 1.2} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 125071002} m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -107.61, z: 0} --- !u!114 &1680796423 MonoBehaviour: m_ObjectHideFlags: 0 @@ -550,13 +657,13 @@ MonoBehaviour: m_ActionEvents: - m_PersistentCalls: m_Calls: - - m_Target: {fileID: 11500000, guid: abf8abec29a380b62a51f97e17907845, type: 3} - m_TargetAssemblyTypeName: - m_MethodName: - m_Mode: 1 + - m_Target: {fileID: 1680796424} + m_TargetAssemblyTypeName: PlayerMovement, Assembly-CSharp + m_MethodName: OnMove + m_Mode: 0 m_Arguments: m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 m_StringArgument: @@ -631,6 +738,8 @@ MonoBehaviour: m_EditorClassIdentifier: controller: {fileID: 1680796425} speed: 10 + mouseSensitivity: 100 + playerBody: {fileID: 1680796422} --- !u!143 &1680796425 CharacterController: m_ObjectHideFlags: 0 @@ -650,8 +759,8 @@ CharacterController: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Height: 2 - m_Radius: 0.5 + m_Height: 3.8 + m_Radius: 0.6 m_SlopeLimit: 45 m_StepOffset: 0.3 m_SkinWidth: 0.08 @@ -661,7 +770,6 @@ CharacterController: SceneRoots: m_ObjectHideFlags: 0 m_Roots: - - {fileID: 125071002} - {fileID: 574677459} - {fileID: 463387416} - {fileID: 1680796422} diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 4a7f678e..b3eaa9c0 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -5,14 +5,30 @@ using UnityEngine.InputSystem; public class PlayerMovement : MonoBehaviour { + private InputMaster _inputMaster; [SerializeField] private CharacterController controller; [SerializeField] private float speed; - + [SerializeField] private float mouseSensitivity = 20f; + [SerializeField] private Transform playerBody; + + private float _mouseX, _mouseY; + private Vector2 _moveDirection; private void Awake() { controller = GetComponent(); + _inputMaster = new InputMaster(); + _inputMaster.Player.Look.Enable(); + _inputMaster.Player.Move.Enable(); + } + + private void Update() + { + var mousevalue = _inputMaster.Player.Look.ReadValue(); + _mouseX = mousevalue.x * mouseSensitivity * Time.deltaTime; + _mouseY = mousevalue.y * mouseSensitivity * Time.deltaTime; + playerBody.Rotate(Vector3.up * _mouseX); } public void OnMove(InputAction.CallbackContext context)