Swapping input systems and using a class called InputData to store player's input
This commit is contained in:
743
Assets/InputConfig.cs
Normal file
743
Assets/InputConfig.cs
Normal file
@@ -0,0 +1,743 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.14.2
|
||||
// from Assets/Settings/InputConfig.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;
|
||||
|
||||
/// <summary>
|
||||
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Settings/InputConfig.inputactions".
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// 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
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public partial class @InputConfig: IInputActionCollection2, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the underlying asset instance.
|
||||
/// </summary>
|
||||
public InputActionAsset asset { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public @InputConfig()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""version"": 1,
|
||||
""name"": ""InputConfig"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""Default"",
|
||||
""id"": ""0625d9c0-43b5-4745-824b-9fda8ba30fee"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Camera Horizontal"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""c07137df-45a6-4c7f-a7a9-4a0308e41992"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Camera Vertical"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""65ba5ae5-0f08-4c90-85ef-ff497cb253b9"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""9ec96503-2099-45d3-aaf2-cf1475edb473"",
|
||||
""path"": ""<Gamepad>/leftStick/x"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Horizontal"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""ed76a404-3e05-4d45-a021-05844bc10505"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Horizontal"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""negative"",
|
||||
""id"": ""d655a04f-766a-439d-901d-794696b1ec89"",
|
||||
""path"": ""<Keyboard>/a"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Horizontal"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""positive"",
|
||||
""id"": ""b0d947fc-bec7-46a7-9704-afc08a1e2886"",
|
||||
""path"": ""<Keyboard>/d"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Horizontal"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""ede8a471-011b-444f-aea7-3079794926f1"",
|
||||
""path"": ""<Gamepad>/leftStick/y"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Vertical"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""e9f01183-aa1d-4ebf-9799-09aec02d3cf8"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Vertical"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""negative"",
|
||||
""id"": ""908edb1a-3d82-4454-9d8e-2020aafd0714"",
|
||||
""path"": ""<Keyboard>/s"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Vertical"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""positive"",
|
||||
""id"": ""34639f79-f10f-4950-96dc-b2a5ab43c4a7"",
|
||||
""path"": ""<Keyboard>/w"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Camera Vertical"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Marketing"",
|
||||
""id"": ""56f2eb0a-da06-47a3-9123-f39cfe90e6a1"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""CameraFOV"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""970c903e-bdb9-42ab-b5e5-0e5019ac0994"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""CameraUpDown"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""ad16855f-155a-4c1c-9557-171868403461"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""CameraRotationX"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""f47fc852-b65d-4ae3-8ee4-c4e948103760"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""CameraRotationY"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""54a4cdd3-92f4-4562-bc26-932f1ecf3961"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""5b23e3c8-fa10-4d03-81ba-247c869d1e57"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraFOV"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""negative"",
|
||||
""id"": ""ebd13f12-54ac-4f07-b24b-8794856068a5"",
|
||||
""path"": ""<Keyboard>/o"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraFOV"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""positive"",
|
||||
""id"": ""6e9ad397-b3d9-4b84-ab9c-fc1621b99e13"",
|
||||
""path"": ""<Keyboard>/p"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraFOV"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""c0c2a08a-f7cc-4b85-bfc0-d645d7b3f48f"",
|
||||
""path"": ""<Gamepad>/dpad/x"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraFOV"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""8d66cc2f-effa-47c4-8d9c-f1f89c9fbebc"",
|
||||
""path"": ""<Gamepad>/dpad/y"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraUpDown"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""77e92290-0b17-41f7-a044-9109ddfb1149"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraUpDown"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""negative"",
|
||||
""id"": ""1797a6a8-20e6-420a-9623-f49123d9c18a"",
|
||||
""path"": ""<Keyboard>/k"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraUpDown"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""positive"",
|
||||
""id"": ""77a25d8f-be60-4403-84a5-b32f4199555b"",
|
||||
""path"": ""<Keyboard>/l"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraUpDown"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""1a68b1f2-634e-47f5-b88c-29be850e1a75"",
|
||||
""path"": ""<Gamepad>/rightStick/x"",
|
||||
""interactions"": """",
|
||||
""processors"": ""Invert"",
|
||||
""groups"": """",
|
||||
""action"": ""CameraRotationX"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""222a9167-cf4e-473e-bcd8-173c4084fa81"",
|
||||
""path"": ""<Gamepad>/rightStick/y"",
|
||||
""interactions"": """",
|
||||
""processors"": ""Invert"",
|
||||
""groups"": """",
|
||||
""action"": ""CameraRotationY"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": []
|
||||
}");
|
||||
// Default
|
||||
m_Default = asset.FindActionMap("Default", throwIfNotFound: true);
|
||||
m_Default_CameraHorizontal = m_Default.FindAction("Camera Horizontal", throwIfNotFound: true);
|
||||
m_Default_CameraVertical = m_Default.FindAction("Camera Vertical", throwIfNotFound: true);
|
||||
// Marketing
|
||||
m_Marketing = asset.FindActionMap("Marketing", throwIfNotFound: true);
|
||||
m_Marketing_CameraFOV = m_Marketing.FindAction("CameraFOV", throwIfNotFound: true);
|
||||
m_Marketing_CameraUpDown = m_Marketing.FindAction("CameraUpDown", throwIfNotFound: true);
|
||||
m_Marketing_CameraRotationX = m_Marketing.FindAction("CameraRotationX", throwIfNotFound: true);
|
||||
m_Marketing_CameraRotationY = m_Marketing.FindAction("CameraRotationY", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
~@InputConfig()
|
||||
{
|
||||
UnityEngine.Debug.Assert(!m_Default.enabled, "This will cause a leak and performance issues, InputConfig.Default.Disable() has not been called.");
|
||||
UnityEngine.Debug.Assert(!m_Marketing.enabled, "This will cause a leak and performance issues, InputConfig.Marketing.Disable() has not been called.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this asset and all associated <see cref="InputAction"/> instances.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.Destroy(asset);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
|
||||
public InputBinding? bindingMask
|
||||
{
|
||||
get => asset.bindingMask;
|
||||
set => asset.bindingMask = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
|
||||
public ReadOnlyArray<InputDevice>? devices
|
||||
{
|
||||
get => asset.devices;
|
||||
set => asset.devices = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
|
||||
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
|
||||
public bool Contains(InputAction action)
|
||||
{
|
||||
return asset.Contains(action);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
|
||||
public IEnumerator<InputAction> GetEnumerator()
|
||||
{
|
||||
return asset.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IEnumerable.GetEnumerator()" />
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
|
||||
public void Enable()
|
||||
{
|
||||
asset.Enable();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
|
||||
public void Disable()
|
||||
{
|
||||
asset.Disable();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
|
||||
public IEnumerable<InputBinding> bindings => asset.bindings;
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
|
||||
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
||||
{
|
||||
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
|
||||
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
||||
{
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// Default
|
||||
private readonly InputActionMap m_Default;
|
||||
private List<IDefaultActions> m_DefaultActionsCallbackInterfaces = new List<IDefaultActions>();
|
||||
private readonly InputAction m_Default_CameraHorizontal;
|
||||
private readonly InputAction m_Default_CameraVertical;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Default".
|
||||
/// </summary>
|
||||
public struct DefaultActions
|
||||
{
|
||||
private @InputConfig m_Wrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance of the input action map wrapper class.
|
||||
/// </summary>
|
||||
public DefaultActions(@InputConfig wrapper) { m_Wrapper = wrapper; }
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Default/CameraHorizontal".
|
||||
/// </summary>
|
||||
public InputAction @CameraHorizontal => m_Wrapper.m_Default_CameraHorizontal;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Default/CameraVertical".
|
||||
/// </summary>
|
||||
public InputAction @CameraVertical => m_Wrapper.m_Default_CameraVertical;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Default; }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
||||
public void Enable() { Get().Enable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
||||
public void Disable() { Get().Disable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
||||
public bool enabled => Get().enabled;
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see ref="DefaultActions" /> to an <see ref="InputActionMap" /> instance.
|
||||
/// </summary>
|
||||
public static implicit operator InputActionMap(DefaultActions set) { return set.Get(); }
|
||||
/// <summary>
|
||||
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <param name="instance">Callback instance.</param>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
||||
/// </remarks>
|
||||
/// <seealso cref="DefaultActions" />
|
||||
public void AddCallbacks(IDefaultActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_DefaultActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_DefaultActionsCallbackInterfaces.Add(instance);
|
||||
@CameraHorizontal.started += instance.OnCameraHorizontal;
|
||||
@CameraHorizontal.performed += instance.OnCameraHorizontal;
|
||||
@CameraHorizontal.canceled += instance.OnCameraHorizontal;
|
||||
@CameraVertical.started += instance.OnCameraVertical;
|
||||
@CameraVertical.performed += instance.OnCameraVertical;
|
||||
@CameraVertical.canceled += instance.OnCameraVertical;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
||||
/// </remarks>
|
||||
/// <seealso cref="DefaultActions" />
|
||||
private void UnregisterCallbacks(IDefaultActions instance)
|
||||
{
|
||||
@CameraHorizontal.started -= instance.OnCameraHorizontal;
|
||||
@CameraHorizontal.performed -= instance.OnCameraHorizontal;
|
||||
@CameraHorizontal.canceled -= instance.OnCameraHorizontal;
|
||||
@CameraVertical.started -= instance.OnCameraVertical;
|
||||
@CameraVertical.performed -= instance.OnCameraVertical;
|
||||
@CameraVertical.canceled -= instance.OnCameraVertical;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="DefaultActions.UnregisterCallbacks(IDefaultActions)" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="DefaultActions.UnregisterCallbacks(IDefaultActions)" />
|
||||
public void RemoveCallbacks(IDefaultActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_DefaultActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
||||
/// </remarks>
|
||||
/// <seealso cref="DefaultActions.AddCallbacks(IDefaultActions)" />
|
||||
/// <seealso cref="DefaultActions.RemoveCallbacks(IDefaultActions)" />
|
||||
/// <seealso cref="DefaultActions.UnregisterCallbacks(IDefaultActions)" />
|
||||
public void SetCallbacks(IDefaultActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_DefaultActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_DefaultActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Provides a new <see cref="DefaultActions" /> instance referencing this action map.
|
||||
/// </summary>
|
||||
public DefaultActions @Default => new DefaultActions(this);
|
||||
|
||||
// Marketing
|
||||
private readonly InputActionMap m_Marketing;
|
||||
private List<IMarketingActions> m_MarketingActionsCallbackInterfaces = new List<IMarketingActions>();
|
||||
private readonly InputAction m_Marketing_CameraFOV;
|
||||
private readonly InputAction m_Marketing_CameraUpDown;
|
||||
private readonly InputAction m_Marketing_CameraRotationX;
|
||||
private readonly InputAction m_Marketing_CameraRotationY;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Marketing".
|
||||
/// </summary>
|
||||
public struct MarketingActions
|
||||
{
|
||||
private @InputConfig m_Wrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance of the input action map wrapper class.
|
||||
/// </summary>
|
||||
public MarketingActions(@InputConfig wrapper) { m_Wrapper = wrapper; }
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Marketing/CameraFOV".
|
||||
/// </summary>
|
||||
public InputAction @CameraFOV => m_Wrapper.m_Marketing_CameraFOV;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Marketing/CameraUpDown".
|
||||
/// </summary>
|
||||
public InputAction @CameraUpDown => m_Wrapper.m_Marketing_CameraUpDown;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Marketing/CameraRotationX".
|
||||
/// </summary>
|
||||
public InputAction @CameraRotationX => m_Wrapper.m_Marketing_CameraRotationX;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Marketing/CameraRotationY".
|
||||
/// </summary>
|
||||
public InputAction @CameraRotationY => m_Wrapper.m_Marketing_CameraRotationY;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Marketing; }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
||||
public void Enable() { Get().Enable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
||||
public void Disable() { Get().Disable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
||||
public bool enabled => Get().enabled;
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see ref="MarketingActions" /> to an <see ref="InputActionMap" /> instance.
|
||||
/// </summary>
|
||||
public static implicit operator InputActionMap(MarketingActions set) { return set.Get(); }
|
||||
/// <summary>
|
||||
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <param name="instance">Callback instance.</param>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
||||
/// </remarks>
|
||||
/// <seealso cref="MarketingActions" />
|
||||
public void AddCallbacks(IMarketingActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_MarketingActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_MarketingActionsCallbackInterfaces.Add(instance);
|
||||
@CameraFOV.started += instance.OnCameraFOV;
|
||||
@CameraFOV.performed += instance.OnCameraFOV;
|
||||
@CameraFOV.canceled += instance.OnCameraFOV;
|
||||
@CameraUpDown.started += instance.OnCameraUpDown;
|
||||
@CameraUpDown.performed += instance.OnCameraUpDown;
|
||||
@CameraUpDown.canceled += instance.OnCameraUpDown;
|
||||
@CameraRotationX.started += instance.OnCameraRotationX;
|
||||
@CameraRotationX.performed += instance.OnCameraRotationX;
|
||||
@CameraRotationX.canceled += instance.OnCameraRotationX;
|
||||
@CameraRotationY.started += instance.OnCameraRotationY;
|
||||
@CameraRotationY.performed += instance.OnCameraRotationY;
|
||||
@CameraRotationY.canceled += instance.OnCameraRotationY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
||||
/// </remarks>
|
||||
/// <seealso cref="MarketingActions" />
|
||||
private void UnregisterCallbacks(IMarketingActions instance)
|
||||
{
|
||||
@CameraFOV.started -= instance.OnCameraFOV;
|
||||
@CameraFOV.performed -= instance.OnCameraFOV;
|
||||
@CameraFOV.canceled -= instance.OnCameraFOV;
|
||||
@CameraUpDown.started -= instance.OnCameraUpDown;
|
||||
@CameraUpDown.performed -= instance.OnCameraUpDown;
|
||||
@CameraUpDown.canceled -= instance.OnCameraUpDown;
|
||||
@CameraRotationX.started -= instance.OnCameraRotationX;
|
||||
@CameraRotationX.performed -= instance.OnCameraRotationX;
|
||||
@CameraRotationX.canceled -= instance.OnCameraRotationX;
|
||||
@CameraRotationY.started -= instance.OnCameraRotationY;
|
||||
@CameraRotationY.performed -= instance.OnCameraRotationY;
|
||||
@CameraRotationY.canceled -= instance.OnCameraRotationY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="MarketingActions.UnregisterCallbacks(IMarketingActions)" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="MarketingActions.UnregisterCallbacks(IMarketingActions)" />
|
||||
public void RemoveCallbacks(IMarketingActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_MarketingActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
||||
/// </remarks>
|
||||
/// <seealso cref="MarketingActions.AddCallbacks(IMarketingActions)" />
|
||||
/// <seealso cref="MarketingActions.RemoveCallbacks(IMarketingActions)" />
|
||||
/// <seealso cref="MarketingActions.UnregisterCallbacks(IMarketingActions)" />
|
||||
public void SetCallbacks(IMarketingActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_MarketingActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_MarketingActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Provides a new <see cref="MarketingActions" /> instance referencing this action map.
|
||||
/// </summary>
|
||||
public MarketingActions @Marketing => new MarketingActions(this);
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Default" which allows adding and removing callbacks.
|
||||
/// </summary>
|
||||
/// <seealso cref="DefaultActions.AddCallbacks(IDefaultActions)" />
|
||||
/// <seealso cref="DefaultActions.RemoveCallbacks(IDefaultActions)" />
|
||||
public interface IDefaultActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Camera Horizontal" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnCameraHorizontal(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Camera Vertical" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnCameraVertical(InputAction.CallbackContext context);
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Marketing" which allows adding and removing callbacks.
|
||||
/// </summary>
|
||||
/// <seealso cref="MarketingActions.AddCallbacks(IMarketingActions)" />
|
||||
/// <seealso cref="MarketingActions.RemoveCallbacks(IMarketingActions)" />
|
||||
public interface IMarketingActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "CameraFOV" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnCameraFOV(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "CameraUpDown" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnCameraUpDown(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "CameraRotationX" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnCameraRotationX(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "CameraRotationY" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnCameraRotationY(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user