Maze / Library /PackageCache /com.unity.inputsystem@1.6.1 /Samples~ /DocsExamples /Actions /ExampleActions.cs
| //------------------------------------------------------------------------------ | |
| // <auto-generated> | |
| // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator | |
| // version 1.4.3 | |
| // from Assets/Samples/DocsExamples/Actions/ExampleActions.inputactions | |
| // | |
| // Changes to this file may cause incorrect behavior and will be lost if | |
| // the code is regenerated. | |
| // </auto-generated> | |
| //------------------------------------------------------------------------------ | |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine.InputSystem; | |
| using UnityEngine.InputSystem.Utilities; | |
| public partial class @ExampleActions: IInputActionCollection2, IDisposable | |
| { | |
| public InputActionAsset asset { get; } | |
| public @ExampleActions() | |
| { | |
| asset = InputActionAsset.FromJson(@"{ | |
| ""name"": ""ExampleActions"", | |
| ""maps"": [ | |
| { | |
| ""name"": ""gameplay"", | |
| ""id"": ""d55be63c-61eb-47ef-92dd-eef1248d601e"", | |
| ""actions"": [ | |
| { | |
| ""name"": ""move"", | |
| ""type"": ""Value"", | |
| ""id"": ""8387a17d-aedd-4411-9931-6a855a8299fb"", | |
| ""expectedControlType"": ""Vector2"", | |
| ""processors"": """", | |
| ""interactions"": """", | |
| ""initialStateCheck"": true | |
| }, | |
| { | |
| ""name"": ""jump"", | |
| ""type"": ""Button"", | |
| ""id"": ""7fc1eb3c-b4d1-4aba-9a58-f36cac532d06"", | |
| ""expectedControlType"": ""Button"", | |
| ""processors"": """", | |
| ""interactions"": """", | |
| ""initialStateCheck"": false | |
| }, | |
| { | |
| ""name"": ""crouch"", | |
| ""type"": ""Button"", | |
| ""id"": ""851b3e53-f21f-4ba6-94fa-9f0b4db1ccb4"", | |
| ""expectedControlType"": ""Button"", | |
| ""processors"": """", | |
| ""interactions"": """", | |
| ""initialStateCheck"": false | |
| }, | |
| { | |
| ""name"": ""use"", | |
| ""type"": ""Button"", | |
| ""id"": ""b5f08480-c03b-4654-8475-9c94e8ccccaf"", | |
| ""expectedControlType"": ""Button"", | |
| ""processors"": """", | |
| ""interactions"": """", | |
| ""initialStateCheck"": false | |
| } | |
| ], | |
| ""bindings"": [ | |
| { | |
| ""name"": """", | |
| ""id"": ""2c541328-ed00-4524-817c-97599bac7de5"", | |
| ""path"": ""<Gamepad>{Player1}/leftStick"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""move"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": ""2D Vector"", | |
| ""id"": ""1bff55cb-bc9f-4a07-921b-c363f330e099"", | |
| ""path"": ""2DVector"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""move"", | |
| ""isComposite"": true, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": ""up"", | |
| ""id"": ""a463e3bc-75b0-4b56-a790-05e2b7fd264c"", | |
| ""path"": ""<Keyboard>/upArrow"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""move"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": true | |
| }, | |
| { | |
| ""name"": ""down"", | |
| ""id"": ""875ee5b9-f51e-4e41-bad6-930e14120008"", | |
| ""path"": ""<Keyboard>/downArrow"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""move"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": true | |
| }, | |
| { | |
| ""name"": ""left"", | |
| ""id"": ""63c4eca5-962b-429e-8988-41dbdd085179"", | |
| ""path"": ""<Keyboard>/leftArrow"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""move"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": true | |
| }, | |
| { | |
| ""name"": ""right"", | |
| ""id"": ""bfd5fbe5-e471-45c2-bcf9-905f21b37819"", | |
| ""path"": ""<Keyboard>/rightArrow"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""move"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": true | |
| }, | |
| { | |
| ""name"": """", | |
| ""id"": ""c48db537-b211-412a-a86a-d31614bebb5d"", | |
| ""path"": ""<Gamepad>{Player1}/buttonSouth"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""jump"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": """", | |
| ""id"": ""9a105e9c-c84a-4269-852a-29220b37c2a4"", | |
| ""path"": ""<Keyboard>/space"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""jump"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": """", | |
| ""id"": ""636da59d-2ea1-4682-b67d-a40f48fa02a5"", | |
| ""path"": ""<Gamepad>{Player1}/buttonWest"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""crouch"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": """", | |
| ""id"": ""69f2763d-08bc-4aac-9c35-f4f5f22e2928"", | |
| ""path"": ""<Keyboard>/z"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""crouch"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": """", | |
| ""id"": ""41041dd1-570a-487c-856e-d58cfa06509a"", | |
| ""path"": ""<Gamepad>{Player1}/buttonNorth"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""use"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| }, | |
| { | |
| ""name"": """", | |
| ""id"": ""4ac0be70-ea16-4ea3-98d4-0cf19fab4aec"", | |
| ""path"": ""<Keyboard>/x"", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""use"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| } | |
| ] | |
| }, | |
| { | |
| ""name"": ""menus"", | |
| ""id"": ""4d6bdb0c-7386-48fd-b39c-65304c2d209d"", | |
| ""actions"": [ | |
| { | |
| ""name"": ""New action"", | |
| ""type"": ""Button"", | |
| ""id"": ""e4dd2c60-a6d7-4ccd-8c2f-151ad3cf28a0"", | |
| ""expectedControlType"": ""Button"", | |
| ""processors"": """", | |
| ""interactions"": """", | |
| ""initialStateCheck"": false | |
| } | |
| ], | |
| ""bindings"": [ | |
| { | |
| ""name"": """", | |
| ""id"": ""3599143f-75d5-4647-8633-83410cf6d8f8"", | |
| ""path"": """", | |
| ""interactions"": """", | |
| ""processors"": """", | |
| ""groups"": """", | |
| ""action"": ""New action"", | |
| ""isComposite"": false, | |
| ""isPartOfComposite"": false | |
| } | |
| ] | |
| } | |
| ], | |
| ""controlSchemes"": [] | |
| }"); | |
| // gameplay | |
| m_gameplay = asset.FindActionMap("gameplay", throwIfNotFound: true); | |
| m_gameplay_move = m_gameplay.FindAction("move", throwIfNotFound: true); | |
| m_gameplay_jump = m_gameplay.FindAction("jump", throwIfNotFound: true); | |
| m_gameplay_crouch = m_gameplay.FindAction("crouch", throwIfNotFound: true); | |
| m_gameplay_use = m_gameplay.FindAction("use", throwIfNotFound: true); | |
| // menus | |
| m_menus = asset.FindActionMap("menus", throwIfNotFound: true); | |
| m_menus_Newaction = m_menus.FindAction("New action", throwIfNotFound: true); | |
| } | |
| public void Dispose() | |
| { | |
| UnityEngine.Object.Destroy(asset); | |
| } | |
| public InputBinding? bindingMask | |
| { | |
| get => asset.bindingMask; | |
| set => asset.bindingMask = value; | |
| } | |
| public ReadOnlyArray<InputDevice>? devices | |
| { | |
| get => asset.devices; | |
| set => asset.devices = value; | |
| } | |
| public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes; | |
| public bool Contains(InputAction action) | |
| { | |
| return asset.Contains(action); | |
| } | |
| public IEnumerator<InputAction> GetEnumerator() | |
| { | |
| return asset.GetEnumerator(); | |
| } | |
| IEnumerator IEnumerable.GetEnumerator() | |
| { | |
| return GetEnumerator(); | |
| } | |
| public void Enable() | |
| { | |
| asset.Enable(); | |
| } | |
| public void Disable() | |
| { | |
| asset.Disable(); | |
| } | |
| public IEnumerable<InputBinding> 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); | |
| } | |
| // gameplay | |
| private readonly InputActionMap m_gameplay; | |
| private IGameplayActions m_GameplayActionsCallbackInterface; | |
| private readonly InputAction m_gameplay_move; | |
| private readonly InputAction m_gameplay_jump; | |
| private readonly InputAction m_gameplay_crouch; | |
| private readonly InputAction m_gameplay_use; | |
| public struct GameplayActions | |
| { | |
| private @ExampleActions m_Wrapper; | |
| public GameplayActions(@ExampleActions wrapper) { m_Wrapper = wrapper; } | |
| public InputAction @move => m_Wrapper.m_gameplay_move; | |
| public InputAction @jump => m_Wrapper.m_gameplay_jump; | |
| public InputAction @crouch => m_Wrapper.m_gameplay_crouch; | |
| public InputAction @use => m_Wrapper.m_gameplay_use; | |
| public InputActionMap Get() { return m_Wrapper.m_gameplay; } | |
| public void Enable() { Get().Enable(); } | |
| public void Disable() { Get().Disable(); } | |
| public bool enabled => Get().enabled; | |
| public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); } | |
| public void SetCallbacks(IGameplayActions instance) | |
| { | |
| if (m_Wrapper.m_GameplayActionsCallbackInterface != null) | |
| { | |
| @move.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove; | |
| @move.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove; | |
| @move.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove; | |
| @jump.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnJump; | |
| @jump.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnJump; | |
| @jump.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnJump; | |
| @crouch.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnCrouch; | |
| @crouch.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnCrouch; | |
| @crouch.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnCrouch; | |
| @use.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnUse; | |
| @use.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnUse; | |
| @use.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnUse; | |
| } | |
| m_Wrapper.m_GameplayActionsCallbackInterface = instance; | |
| if (instance != null) | |
| { | |
| @move.started += instance.OnMove; | |
| @move.performed += instance.OnMove; | |
| @move.canceled += instance.OnMove; | |
| @jump.started += instance.OnJump; | |
| @jump.performed += instance.OnJump; | |
| @jump.canceled += instance.OnJump; | |
| @crouch.started += instance.OnCrouch; | |
| @crouch.performed += instance.OnCrouch; | |
| @crouch.canceled += instance.OnCrouch; | |
| @use.started += instance.OnUse; | |
| @use.performed += instance.OnUse; | |
| @use.canceled += instance.OnUse; | |
| } | |
| } | |
| } | |
| public GameplayActions @gameplay => new GameplayActions(this); | |
| // menus | |
| private readonly InputActionMap m_menus; | |
| private IMenusActions m_MenusActionsCallbackInterface; | |
| private readonly InputAction m_menus_Newaction; | |
| public struct MenusActions | |
| { | |
| private @ExampleActions m_Wrapper; | |
| public MenusActions(@ExampleActions wrapper) { m_Wrapper = wrapper; } | |
| public InputAction @Newaction => m_Wrapper.m_menus_Newaction; | |
| public InputActionMap Get() { return m_Wrapper.m_menus; } | |
| public void Enable() { Get().Enable(); } | |
| public void Disable() { Get().Disable(); } | |
| public bool enabled => Get().enabled; | |
| public static implicit operator InputActionMap(MenusActions set) { return set.Get(); } | |
| public void SetCallbacks(IMenusActions instance) | |
| { | |
| if (m_Wrapper.m_MenusActionsCallbackInterface != null) | |
| { | |
| @Newaction.started -= m_Wrapper.m_MenusActionsCallbackInterface.OnNewaction; | |
| @Newaction.performed -= m_Wrapper.m_MenusActionsCallbackInterface.OnNewaction; | |
| @Newaction.canceled -= m_Wrapper.m_MenusActionsCallbackInterface.OnNewaction; | |
| } | |
| m_Wrapper.m_MenusActionsCallbackInterface = instance; | |
| if (instance != null) | |
| { | |
| @Newaction.started += instance.OnNewaction; | |
| @Newaction.performed += instance.OnNewaction; | |
| @Newaction.canceled += instance.OnNewaction; | |
| } | |
| } | |
| } | |
| public MenusActions @menus => new MenusActions(this); | |
| public interface IGameplayActions | |
| { | |
| void OnMove(InputAction.CallbackContext context); | |
| void OnJump(InputAction.CallbackContext context); | |
| void OnCrouch(InputAction.CallbackContext context); | |
| void OnUse(InputAction.CallbackContext context); | |
| } | |
| public interface IMenusActions | |
| { | |
| void OnNewaction(InputAction.CallbackContext context); | |
| } | |
| } | |