//------------------------------------------------------------------------------ // // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator // version 1.13.1 // from Assets/Art/GameInputSO.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/Art/GameInputSO.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 @GameInput: IInputActionCollection2, IDisposable { /// /// Provides access to the underlying asset instance. /// public InputActionAsset asset { get; } /// /// Constructs a new instance. /// public @GameInput() { asset = InputActionAsset.FromJson(@"{ ""name"": ""GameInputSO"", ""maps"": [ { ""name"": ""Player"", ""id"": ""f62a4b92-ef5e-4175-8f4c-c9075429d32c"", ""actions"": [ { ""name"": ""Move"", ""type"": ""Value"", ""id"": ""6bc1aaf4-b110-4ff7-891e-5b9fe6f32c4d"", ""expectedControlType"": ""Vector2"", ""processors"": """", ""interactions"": """", ""initialStateCheck"": true }, { ""name"": ""Look"", ""type"": ""Value"", ""id"": ""2690c379-f54d-45be-a724-414123833eb4"", ""expectedControlType"": ""Vector2"", ""processors"": """", ""interactions"": """", ""initialStateCheck"": true }, { ""name"": ""Jump"", ""type"": ""Button"", ""id"": ""8c4abdf8-4099-493a-aa1a-129acec7c3df"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""Sprint"", ""type"": ""Value"", ""id"": ""980e881e-182c-404c-8cbf-3d09fdb48fef"", ""expectedControlType"": ""Button"", ""processors"": """", ""interactions"": """", ""initialStateCheck"": true }, { ""name"": ""Escape"", ""type"": ""Button"", ""id"": ""d0bfd212-2876-4c8e-b35e-cfb618a9dc0b"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""InteractPrimary"", ""type"": ""Button"", ""id"": ""66b26e9d-c51a-4fb2-a4cc-3f44bdff3355"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""InteractSecondary"", ""type"": ""Button"", ""id"": ""5cc4edbd-955c-4718-8bce-ce78d07abf3f"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""Zoom"", ""type"": ""PassThrough"", ""id"": ""702f73cf-2f96-4624-871e-f1263393b8f5"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""Toggle Walking"", ""type"": ""Button"", ""id"": ""4a6790ad-d534-44f4-bfde-3a550760bd39"", ""expectedControlType"": """", ""processors"": """", ""interactions"": ""Press(behavior=1)"", ""initialStateCheck"": false } ], ""bindings"": [ { ""name"": ""WASD"", ""id"": ""b7594ddb-26c9-4ba2-bd5a-901468929edc"", ""path"": ""2DVector(mode=1)"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Move"", ""isComposite"": true, ""isPartOfComposite"": false }, { ""name"": ""up"", ""id"": ""2063a8b5-6a45-43de-851b-65f3d46e7b58"", ""path"": ""/w"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""down"", ""id"": ""64e4d037-32e1-4fb9-80e4-fc7330404dfe"", ""path"": ""/s"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""left"", ""id"": ""0fce8b11-5eab-4e4e-a741-b732e7b20873"", ""path"": ""/a"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""right"", ""id"": ""7bdda0d6-57a8-47c8-8238-8aecf3110e47"", ""path"": ""/d"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""up"", ""id"": ""bb94b405-58d3-4998-8535-d705c1218a98"", ""path"": ""/upArrow"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""down"", ""id"": ""929d9071-7dd0-4368-9743-6793bb98087e"", ""path"": ""/downArrow"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""left"", ""id"": ""28abadba-06ff-4d37-bb70-af2f1e35a3b9"", ""path"": ""/leftArrow"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": ""right"", ""id"": ""45f115b6-9b4f-4ba8-b500-b94c93bf7d7e"", ""path"": ""/rightArrow"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": true }, { ""name"": """", ""id"": ""e2f9aa65-db06-4c5b-a2e9-41bc8acb9517"", ""path"": ""/leftStick"", ""interactions"": """", ""processors"": ""StickDeadzone"", ""groups"": ""Gamepad"", ""action"": ""Move"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""ed66cbff-2900-4a62-8896-696503cfcd31"", ""path"": ""/delta"", ""interactions"": """", ""processors"": ""InvertVector2(invertX=false),ScaleVector2(x=0.05,y=0.05)"", ""groups"": ""KeyboardMouse"", ""action"": ""Look"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""d1d171b6-19d8-47a6-ba3a-71b6a8e7b3c0"", ""path"": ""/rightStick"", ""interactions"": """", ""processors"": ""InvertVector2(invertX=false),StickDeadzone,ScaleVector2(x=300,y=300)"", ""groups"": ""Gamepad"", ""action"": ""Look"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""1bd55a0b-761e-4ae4-89ae-8ec127e08a29"", ""path"": ""/space"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Jump"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""9f973413-5e27-4239-acee-38c4a63feeba"", ""path"": ""/buttonSouth"", ""interactions"": """", ""processors"": """", ""groups"": ""Gamepad"", ""action"": ""Jump"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""dc65b89f-9bd3-43fb-92af-d0d87ba5faa4"", ""path"": ""/leftShift"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Sprint"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""c8fcd86e-dcfd-4f88-8e93-b638cdbf3320"", ""path"": ""/leftTrigger"", ""interactions"": """", ""processors"": """", ""groups"": ""Gamepad"", ""action"": ""Sprint"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""2253ad85-a0da-43df-ac0e-ee4d9e37f9fa"", ""path"": ""/escape"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""Escape"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""ec4c5980-4d30-41c4-b1b4-658d52b3a103"", ""path"": ""/leftButton"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""InteractPrimary"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""adcb95fb-24a3-4c13-a238-588970915d06"", ""path"": ""/rightButton"", ""interactions"": """", ""processors"": """", ""groups"": ""KeyboardMouse"", ""action"": ""InteractSecondary"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""18772126-eab8-4125-b643-22aa0566bc51"", ""path"": ""/scroll/y"", ""interactions"": """", ""processors"": ""Clamp(min=-0.1,max=0.1)"", ""groups"": """", ""action"": ""Zoom"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""fcac67ce-ed18-4457-b978-8eff197ccf91"", ""path"": ""/dpad/y"", ""interactions"": """", ""processors"": ""Clamp(min=-0.01,max=0.01)"", ""groups"": """", ""action"": ""Zoom"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""5edc2393-2264-49df-8e82-18f9cfa4e062"", ""path"": ""/leftCtrl"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Toggle Walking"", ""isComposite"": false, ""isPartOfComposite"": false } ] }, { ""name"": ""UI"", ""id"": ""ebfdbacf-7468-4988-9497-b726572473ea"", ""actions"": [ { ""name"": ""Cancel"", ""type"": ""Button"", ""id"": ""1c614fd1-b2d4-4a37-8a58-480ab69e09a5"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""Submit"", ""type"": ""Button"", ""id"": ""8a983366-d7b9-4953-89d1-7f6e4392ecc6"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""Preview"", ""type"": ""Button"", ""id"": ""e7a71393-e8e6-4a67-bcc3-e0b2f7736a33"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false }, { ""name"": ""Next"", ""type"": ""Button"", ""id"": ""4c9cb50b-b816-43be-80f9-7dda2e157ed6"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", ""initialStateCheck"": false } ], ""bindings"": [ { ""name"": """", ""id"": ""55447a8c-bc61-4ae9-98e4-ccdcdb2bd538"", ""path"": ""*/{Cancel}"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Cancel"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""9783ec4c-2684-44b8-b4dc-ca554c527049"", ""path"": ""*/{Submit}"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Submit"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""ed06c1b1-8be6-4a49-b6f1-92ace44585f2"", ""path"": ""/q"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Preview"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""66fbd15f-de18-4bd7-9206-f20b815143b5"", ""path"": ""/leftShoulder"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Preview"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""d718b1bf-5bdf-45c2-8cfd-aa82e21a0159"", ""path"": ""/e"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Next"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", ""id"": ""4902b18f-6005-4127-9cd6-627536a2270b"", ""path"": ""/rightShoulder"", ""interactions"": """", ""processors"": """", ""groups"": """", ""action"": ""Next"", ""isComposite"": false, ""isPartOfComposite"": false } ] } ], ""controlSchemes"": [ { ""name"": ""KeyboardMouse"", ""bindingGroup"": ""KeyboardMouse"", ""devices"": [ { ""devicePath"": """", ""isOptional"": false, ""isOR"": false }, { ""devicePath"": """", ""isOptional"": false, ""isOR"": false } ] }, { ""name"": ""Gamepad"", ""bindingGroup"": ""Gamepad"", ""devices"": [ { ""devicePath"": """", ""isOptional"": true, ""isOR"": false }, { ""devicePath"": """", ""isOptional"": true, ""isOR"": false }, { ""devicePath"": """", ""isOptional"": true, ""isOR"": false } ] }, { ""name"": ""Xbox Controller"", ""bindingGroup"": ""Xbox Controller"", ""devices"": [] }, { ""name"": ""PS4 Controller"", ""bindingGroup"": ""PS4 Controller"", ""devices"": [] } ] }"); // 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_Jump = m_Player.FindAction("Jump", throwIfNotFound: true); m_Player_Sprint = m_Player.FindAction("Sprint", throwIfNotFound: true); m_Player_Escape = m_Player.FindAction("Escape", throwIfNotFound: true); m_Player_InteractPrimary = m_Player.FindAction("InteractPrimary", throwIfNotFound: true); m_Player_InteractSecondary = m_Player.FindAction("InteractSecondary", throwIfNotFound: true); m_Player_Zoom = m_Player.FindAction("Zoom", throwIfNotFound: true); m_Player_ToggleWalking = m_Player.FindAction("Toggle Walking", throwIfNotFound: true); // UI m_UI = asset.FindActionMap("UI", throwIfNotFound: true); m_UI_Cancel = m_UI.FindAction("Cancel", throwIfNotFound: true); m_UI_Submit = m_UI.FindAction("Submit", throwIfNotFound: true); m_UI_Preview = m_UI.FindAction("Preview", throwIfNotFound: true); m_UI_Next = m_UI.FindAction("Next", throwIfNotFound: true); } ~@GameInput() { UnityEngine.Debug.Assert(!m_Player.enabled, "This will cause a leak and performance issues, GameInput.Player.Disable() has not been called."); UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, GameInput.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_Jump; private readonly InputAction m_Player_Sprint; private readonly InputAction m_Player_Escape; private readonly InputAction m_Player_InteractPrimary; private readonly InputAction m_Player_InteractSecondary; private readonly InputAction m_Player_Zoom; private readonly InputAction m_Player_ToggleWalking; /// /// Provides access to input actions defined in input action map "Player". /// public struct PlayerActions { private @GameInput m_Wrapper; /// /// Construct a new instance of the input action map wrapper class. /// public PlayerActions(@GameInput 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/Jump". /// public InputAction @Jump => m_Wrapper.m_Player_Jump; /// /// Provides access to the underlying input action "Player/Sprint". /// public InputAction @Sprint => m_Wrapper.m_Player_Sprint; /// /// Provides access to the underlying input action "Player/Escape". /// public InputAction @Escape => m_Wrapper.m_Player_Escape; /// /// Provides access to the underlying input action "Player/InteractPrimary". /// public InputAction @InteractPrimary => m_Wrapper.m_Player_InteractPrimary; /// /// Provides access to the underlying input action "Player/InteractSecondary". /// public InputAction @InteractSecondary => m_Wrapper.m_Player_InteractSecondary; /// /// Provides access to the underlying input action "Player/Zoom". /// public InputAction @Zoom => m_Wrapper.m_Player_Zoom; /// /// Provides access to the underlying input action "Player/ToggleWalking". /// public InputAction @ToggleWalking => m_Wrapper.m_Player_ToggleWalking; /// /// 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; @Jump.started += instance.OnJump; @Jump.performed += instance.OnJump; @Jump.canceled += instance.OnJump; @Sprint.started += instance.OnSprint; @Sprint.performed += instance.OnSprint; @Sprint.canceled += instance.OnSprint; @Escape.started += instance.OnEscape; @Escape.performed += instance.OnEscape; @Escape.canceled += instance.OnEscape; @InteractPrimary.started += instance.OnInteractPrimary; @InteractPrimary.performed += instance.OnInteractPrimary; @InteractPrimary.canceled += instance.OnInteractPrimary; @InteractSecondary.started += instance.OnInteractSecondary; @InteractSecondary.performed += instance.OnInteractSecondary; @InteractSecondary.canceled += instance.OnInteractSecondary; @Zoom.started += instance.OnZoom; @Zoom.performed += instance.OnZoom; @Zoom.canceled += instance.OnZoom; @ToggleWalking.started += instance.OnToggleWalking; @ToggleWalking.performed += instance.OnToggleWalking; @ToggleWalking.canceled += instance.OnToggleWalking; } /// /// 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; @Jump.started -= instance.OnJump; @Jump.performed -= instance.OnJump; @Jump.canceled -= instance.OnJump; @Sprint.started -= instance.OnSprint; @Sprint.performed -= instance.OnSprint; @Sprint.canceled -= instance.OnSprint; @Escape.started -= instance.OnEscape; @Escape.performed -= instance.OnEscape; @Escape.canceled -= instance.OnEscape; @InteractPrimary.started -= instance.OnInteractPrimary; @InteractPrimary.performed -= instance.OnInteractPrimary; @InteractPrimary.canceled -= instance.OnInteractPrimary; @InteractSecondary.started -= instance.OnInteractSecondary; @InteractSecondary.performed -= instance.OnInteractSecondary; @InteractSecondary.canceled -= instance.OnInteractSecondary; @Zoom.started -= instance.OnZoom; @Zoom.performed -= instance.OnZoom; @Zoom.canceled -= instance.OnZoom; @ToggleWalking.started -= instance.OnToggleWalking; @ToggleWalking.performed -= instance.OnToggleWalking; @ToggleWalking.canceled -= instance.OnToggleWalking; } /// /// 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_Cancel; private readonly InputAction m_UI_Submit; private readonly InputAction m_UI_Preview; private readonly InputAction m_UI_Next; /// /// Provides access to input actions defined in input action map "UI". /// public struct UIActions { private @GameInput m_Wrapper; /// /// Construct a new instance of the input action map wrapper class. /// public UIActions(@GameInput wrapper) { m_Wrapper = wrapper; } /// /// 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/Submit". /// public InputAction @Submit => m_Wrapper.m_UI_Submit; /// /// Provides access to the underlying input action "UI/Preview". /// public InputAction @Preview => m_Wrapper.m_UI_Preview; /// /// Provides access to the underlying input action "UI/Next". /// public InputAction @Next => m_Wrapper.m_UI_Next; /// /// 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); @Cancel.started += instance.OnCancel; @Cancel.performed += instance.OnCancel; @Cancel.canceled += instance.OnCancel; @Submit.started += instance.OnSubmit; @Submit.performed += instance.OnSubmit; @Submit.canceled += instance.OnSubmit; @Preview.started += instance.OnPreview; @Preview.performed += instance.OnPreview; @Preview.canceled += instance.OnPreview; @Next.started += instance.OnNext; @Next.performed += instance.OnNext; @Next.canceled += instance.OnNext; } /// /// 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) { @Cancel.started -= instance.OnCancel; @Cancel.performed -= instance.OnCancel; @Cancel.canceled -= instance.OnCancel; @Submit.started -= instance.OnSubmit; @Submit.performed -= instance.OnSubmit; @Submit.canceled -= instance.OnSubmit; @Preview.started -= instance.OnPreview; @Preview.performed -= instance.OnPreview; @Preview.canceled -= instance.OnPreview; @Next.started -= instance.OnNext; @Next.performed -= instance.OnNext; @Next.canceled -= instance.OnNext; } /// /// 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("KeyboardMouse"); 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_XboxControllerSchemeIndex = -1; /// /// Provides access to the input control scheme. /// /// public InputControlScheme XboxControllerScheme { get { if (m_XboxControllerSchemeIndex == -1) m_XboxControllerSchemeIndex = asset.FindControlSchemeIndex("Xbox Controller"); return asset.controlSchemes[m_XboxControllerSchemeIndex]; } } private int m_PS4ControllerSchemeIndex = -1; /// /// Provides access to the input control scheme. /// /// public InputControlScheme PS4ControllerScheme { get { if (m_PS4ControllerSchemeIndex == -1) m_PS4ControllerSchemeIndex = asset.FindControlSchemeIndex("PS4 Controller"); return asset.controlSchemes[m_PS4ControllerSchemeIndex]; } } /// /// 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 "Jump" is either , or . /// /// /// /// void OnJump(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Sprint" is either , or . /// /// /// /// void OnSprint(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Escape" is either , or . /// /// /// /// void OnEscape(InputAction.CallbackContext context); /// /// Method invoked when associated input action "InteractPrimary" is either , or . /// /// /// /// void OnInteractPrimary(InputAction.CallbackContext context); /// /// Method invoked when associated input action "InteractSecondary" is either , or . /// /// /// /// void OnInteractSecondary(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Zoom" is either , or . /// /// /// /// void OnZoom(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Toggle Walking" is either , or . /// /// /// /// void OnToggleWalking(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 "Cancel" is either , or . /// /// /// /// void OnCancel(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Submit" is either , or . /// /// /// /// void OnSubmit(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Preview" is either , or . /// /// /// /// void OnPreview(InputAction.CallbackContext context); /// /// Method invoked when associated input action "Next" is either , or . /// /// /// /// void OnNext(InputAction.CallbackContext context); } }