New Input System
parent
70e59eeaae
commit
193db85940
@ -0,0 +1,323 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.6.1
|
||||
// from Assets/PlayerInputActions.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 @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
{
|
||||
public InputActionAsset asset { get; }
|
||||
public @PlayerInputActions()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""PlayerInputActions"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""Player"",
|
||||
""id"": ""8be8563d-f86a-4180-9497-327208207374"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""CameraMovement"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""3f95d77d-eac9-4f68-afc7-920a3cf21cf4"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""CameraRotate"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""c2380b6a-5e64-438b-87a5-cfb0fc964439"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""CameraZoom"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""98f04da7-af9e-43e7-86cf-14dffc7c11f3"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Click"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""ea8ff401-d690-47f2-9be5-538a55f1b170"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": ""WASD"",
|
||||
""id"": ""46d35c2a-f806-4a90-a753-9d04ac7ae4e8"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraMovement"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""8450ee4c-47a0-4423-af62-2461fbd6c186"",
|
||||
""path"": ""<Keyboard>/w"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraMovement"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""df4bfb4f-545e-4e1e-9d71-054e257d7c76"",
|
||||
""path"": ""<Keyboard>/s"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraMovement"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""1d645d09-e51c-4beb-9733-e7a2587d0d01"",
|
||||
""path"": ""<Keyboard>/a"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraMovement"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""724c5104-33c0-44fe-88ba-a23037925ea9"",
|
||||
""path"": ""<Keyboard>/d"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraMovement"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""1D Axis"",
|
||||
""id"": ""fefcfddb-2d96-4572-a396-5994ca7d56d8"",
|
||||
""path"": ""1DAxis"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraRotate"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""negative"",
|
||||
""id"": ""15042b53-da04-4ef2-95ef-d87cfe970ae6"",
|
||||
""path"": ""<Keyboard>/e"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraRotate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""positive"",
|
||||
""id"": ""8126d771-a0cb-4485-a176-7cb6ba72a170"",
|
||||
""path"": ""<Keyboard>/q"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CameraRotate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""7d750995-de9a-4511-b593-00673c503e02"",
|
||||
""path"": ""<Mouse>/scroll/y"",
|
||||
""interactions"": """",
|
||||
""processors"": ""Clamp(min=-1,max=1),Invert"",
|
||||
""groups"": """",
|
||||
""action"": ""CameraZoom"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""54249f40-90d3-4e81-83bf-352bedf3bdf3"",
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Click"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": []
|
||||
}");
|
||||
// Player
|
||||
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
|
||||
m_Player_CameraMovement = m_Player.FindAction("CameraMovement", throwIfNotFound: true);
|
||||
m_Player_CameraRotate = m_Player.FindAction("CameraRotate", throwIfNotFound: true);
|
||||
m_Player_CameraZoom = m_Player.FindAction("CameraZoom", throwIfNotFound: true);
|
||||
m_Player_Click = m_Player.FindAction("Click", 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);
|
||||
}
|
||||
|
||||
// Player
|
||||
private readonly InputActionMap m_Player;
|
||||
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
|
||||
private readonly InputAction m_Player_CameraMovement;
|
||||
private readonly InputAction m_Player_CameraRotate;
|
||||
private readonly InputAction m_Player_CameraZoom;
|
||||
private readonly InputAction m_Player_Click;
|
||||
public struct PlayerActions
|
||||
{
|
||||
private @PlayerInputActions m_Wrapper;
|
||||
public PlayerActions(@PlayerInputActions wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @CameraMovement => m_Wrapper.m_Player_CameraMovement;
|
||||
public InputAction @CameraRotate => m_Wrapper.m_Player_CameraRotate;
|
||||
public InputAction @CameraZoom => m_Wrapper.m_Player_CameraZoom;
|
||||
public InputAction @Click => m_Wrapper.m_Player_Click;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IPlayerActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance);
|
||||
@CameraMovement.started += instance.OnCameraMovement;
|
||||
@CameraMovement.performed += instance.OnCameraMovement;
|
||||
@CameraMovement.canceled += instance.OnCameraMovement;
|
||||
@CameraRotate.started += instance.OnCameraRotate;
|
||||
@CameraRotate.performed += instance.OnCameraRotate;
|
||||
@CameraRotate.canceled += instance.OnCameraRotate;
|
||||
@CameraZoom.started += instance.OnCameraZoom;
|
||||
@CameraZoom.performed += instance.OnCameraZoom;
|
||||
@CameraZoom.canceled += instance.OnCameraZoom;
|
||||
@Click.started += instance.OnClick;
|
||||
@Click.performed += instance.OnClick;
|
||||
@Click.canceled += instance.OnClick;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IPlayerActions instance)
|
||||
{
|
||||
@CameraMovement.started -= instance.OnCameraMovement;
|
||||
@CameraMovement.performed -= instance.OnCameraMovement;
|
||||
@CameraMovement.canceled -= instance.OnCameraMovement;
|
||||
@CameraRotate.started -= instance.OnCameraRotate;
|
||||
@CameraRotate.performed -= instance.OnCameraRotate;
|
||||
@CameraRotate.canceled -= instance.OnCameraRotate;
|
||||
@CameraZoom.started -= instance.OnCameraZoom;
|
||||
@CameraZoom.performed -= instance.OnCameraZoom;
|
||||
@CameraZoom.canceled -= instance.OnCameraZoom;
|
||||
@Click.started -= instance.OnClick;
|
||||
@Click.performed -= instance.OnClick;
|
||||
@Click.canceled -= instance.OnClick;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IPlayerActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IPlayerActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public PlayerActions @Player => new PlayerActions(this);
|
||||
public interface IPlayerActions
|
||||
{
|
||||
void OnCameraMovement(InputAction.CallbackContext context);
|
||||
void OnCameraRotate(InputAction.CallbackContext context);
|
||||
void OnCameraZoom(InputAction.CallbackContext context);
|
||||
void OnClick(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d99443e8a27fbb45783355c973509b87
|
||||
@ -0,0 +1,160 @@
|
||||
{
|
||||
"name": "PlayerInputActions",
|
||||
"maps": [
|
||||
{
|
||||
"name": "Player",
|
||||
"id": "8be8563d-f86a-4180-9497-327208207374",
|
||||
"actions": [
|
||||
{
|
||||
"name": "CameraMovement",
|
||||
"type": "Value",
|
||||
"id": "3f95d77d-eac9-4f68-afc7-920a3cf21cf4",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "CameraRotate",
|
||||
"type": "Value",
|
||||
"id": "c2380b6a-5e64-438b-87a5-cfb0fc964439",
|
||||
"expectedControlType": "Axis",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "CameraZoom",
|
||||
"type": "Value",
|
||||
"id": "98f04da7-af9e-43e7-86cf-14dffc7c11f3",
|
||||
"expectedControlType": "Axis",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Click",
|
||||
"type": "Button",
|
||||
"id": "ea8ff401-d690-47f2-9be5-538a55f1b170",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "WASD",
|
||||
"id": "46d35c2a-f806-4a90-a753-9d04ac7ae4e8",
|
||||
"path": "2DVector",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraMovement",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "8450ee4c-47a0-4423-af62-2461fbd6c186",
|
||||
"path": "<Keyboard>/w",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraMovement",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "df4bfb4f-545e-4e1e-9d71-054e257d7c76",
|
||||
"path": "<Keyboard>/s",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraMovement",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "1d645d09-e51c-4beb-9733-e7a2587d0d01",
|
||||
"path": "<Keyboard>/a",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraMovement",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "724c5104-33c0-44fe-88ba-a23037925ea9",
|
||||
"path": "<Keyboard>/d",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraMovement",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "1D Axis",
|
||||
"id": "fefcfddb-2d96-4572-a396-5994ca7d56d8",
|
||||
"path": "1DAxis",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraRotate",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "negative",
|
||||
"id": "15042b53-da04-4ef2-95ef-d87cfe970ae6",
|
||||
"path": "<Keyboard>/e",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraRotate",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "positive",
|
||||
"id": "8126d771-a0cb-4485-a176-7cb6ba72a170",
|
||||
"path": "<Keyboard>/q",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CameraRotate",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "7d750995-de9a-4511-b593-00673c503e02",
|
||||
"path": "<Mouse>/scroll/y",
|
||||
"interactions": "",
|
||||
"processors": "Clamp(min=-1,max=1),Invert",
|
||||
"groups": "",
|
||||
"action": "CameraZoom",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "54249f40-90d3-4e81-83bf-352bedf3bdf3",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Click",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": []
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e82aa231a37a3532bcb2a8422616cd7
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 1
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
Loading…
Reference in New Issue