use the new input system
parent
315a138693
commit
485dfd2dff
@ -0,0 +1,253 @@
|
||||
{
|
||||
"name": "PlayerControls",
|
||||
"maps": [
|
||||
{
|
||||
"name": "Gameplay",
|
||||
"id": "0f158696-2993-40ed-bce5-2f0a3a29093a",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Move",
|
||||
"type": "Value",
|
||||
"id": "e8180706-4a99-4369-be61-f6804d26ed96",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "Jump",
|
||||
"type": "Button",
|
||||
"id": "793c236d-8124-4373-8291-9d5c5a7c2bb2",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "Dash",
|
||||
"type": "Button",
|
||||
"id": "273f58db-399e-4985-9296-8a90e89d27f1",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "1128cb0a-0dc3-4408-88a0-4afe1f6c82ec",
|
||||
"path": "<Gamepad>/leftStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "WASD",
|
||||
"id": "7c390b91-0e17-4d79-b221-7edc5c22a9b8",
|
||||
"path": "2DVector",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "5de67ac2-2f9e-43c9-812e-294f10f93ed7",
|
||||
"path": "<Keyboard>/w",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "7783fbd1-6f70-48a3-86b7-7dc7722897a9",
|
||||
"path": "<Keyboard>/upArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "4da5e308-3b71-49ca-898f-88cf08fe125d",
|
||||
"path": "<Keyboard>/s",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "75f24288-3f1d-441b-95a9-422d134c9401",
|
||||
"path": "<Keyboard>/downArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "c16d1724-6adb-4d58-afe1-050a1b75caea",
|
||||
"path": "<Keyboard>/leftArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "3a35eeeb-c487-4414-9760-09142bfd3d9a",
|
||||
"path": "<Keyboard>/a",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "cc33d0ff-c955-44ad-a2be-2b439cc1ff1a",
|
||||
"path": "<Keyboard>/rightArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "cf081bb3-ee82-45b7-9a85-559ba87dd315",
|
||||
"path": "<Keyboard>/d",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "c516442b-3679-48e0-8bff-c6e19902c800",
|
||||
"path": "<Gamepad>/buttonSouth",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "887c5bef-ae6c-474b-b728-b698e378ae64",
|
||||
"path": "<Keyboard>/space",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "5cf7e53a-e237-414a-aebf-f38fef6c909b",
|
||||
"path": "<Gamepad>/buttonWest",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Dash",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "68b3b805-a0ef-400d-9157-065113e0a91f",
|
||||
"path": "<Keyboard>/enter",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Dash",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "92afca33-2b86-429e-9d5d-4a8603f9fc8c",
|
||||
"path": "<Keyboard>/shift",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard",
|
||||
"action": "Dash",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Menu",
|
||||
"id": "012e31ca-c196-451a-b125-32625b69fd0e",
|
||||
"actions": [
|
||||
{
|
||||
"name": "New action",
|
||||
"type": "Button",
|
||||
"id": "70c541e9-6f8e-443e-b124-26e8a922b42f",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "5ac4cec0-e0e2-4381-99ca-31453af200c0",
|
||||
"path": "",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "New action",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": [
|
||||
{
|
||||
"name": "Gamepad",
|
||||
"bindingGroup": "Gamepad",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Gamepad>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Keyboard",
|
||||
"bindingGroup": "Keyboard",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Keyboard>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 135902785b70322458e3662c17478e1d
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 1
|
||||
wrapperCodePath: Assets/Scripts/PlayerControls.cs
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
@ -0,0 +1,430 @@
|
||||
// GENERATED AUTOMATICALLY FROM 'Assets/PlayerControls.inputactions'
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
public class @PlayerControls : IInputActionCollection, IDisposable
|
||||
{
|
||||
public InputActionAsset asset { get; }
|
||||
public @PlayerControls()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""PlayerControls"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""Gameplay"",
|
||||
""id"": ""0f158696-2993-40ed-bce5-2f0a3a29093a"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Move"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""e8180706-4a99-4369-be61-f6804d26ed96"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """"
|
||||
},
|
||||
{
|
||||
""name"": ""Jump"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""793c236d-8124-4373-8291-9d5c5a7c2bb2"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """"
|
||||
},
|
||||
{
|
||||
""name"": ""Dash"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""273f58db-399e-4985-9296-8a90e89d27f1"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """"
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""1128cb0a-0dc3-4408-88a0-4afe1f6c82ec"",
|
||||
""path"": ""<Gamepad>/leftStick"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""WASD"",
|
||||
""id"": ""7c390b91-0e17-4d79-b221-7edc5c22a9b8"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""5de67ac2-2f9e-43c9-812e-294f10f93ed7"",
|
||||
""path"": ""<Keyboard>/w"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""7783fbd1-6f70-48a3-86b7-7dc7722897a9"",
|
||||
""path"": ""<Keyboard>/upArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""4da5e308-3b71-49ca-898f-88cf08fe125d"",
|
||||
""path"": ""<Keyboard>/s"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""75f24288-3f1d-441b-95a9-422d134c9401"",
|
||||
""path"": ""<Keyboard>/downArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""c16d1724-6adb-4d58-afe1-050a1b75caea"",
|
||||
""path"": ""<Keyboard>/leftArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""3a35eeeb-c487-4414-9760-09142bfd3d9a"",
|
||||
""path"": ""<Keyboard>/a"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""cc33d0ff-c955-44ad-a2be-2b439cc1ff1a"",
|
||||
""path"": ""<Keyboard>/rightArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""cf081bb3-ee82-45b7-9a85-559ba87dd315"",
|
||||
""path"": ""<Keyboard>/d"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""c516442b-3679-48e0-8bff-c6e19902c800"",
|
||||
""path"": ""<Gamepad>/buttonSouth"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Jump"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""887c5bef-ae6c-474b-b728-b698e378ae64"",
|
||||
""path"": ""<Keyboard>/space"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Jump"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""5cf7e53a-e237-414a-aebf-f38fef6c909b"",
|
||||
""path"": ""<Gamepad>/buttonWest"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Dash"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""68b3b805-a0ef-400d-9157-065113e0a91f"",
|
||||
""path"": ""<Keyboard>/enter"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Dash"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""92afca33-2b86-429e-9d5d-4a8603f9fc8c"",
|
||||
""path"": ""<Keyboard>/shift"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard"",
|
||||
""action"": ""Dash"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Menu"",
|
||||
""id"": ""012e31ca-c196-451a-b125-32625b69fd0e"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""New action"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""70c541e9-6f8e-443e-b124-26e8a922b42f"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """"
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""5ac4cec0-e0e2-4381-99ca-31453af200c0"",
|
||||
""path"": """",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""New action"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": [
|
||||
{
|
||||
""name"": ""Gamepad"",
|
||||
""bindingGroup"": ""Gamepad"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<Gamepad>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Keyboard"",
|
||||
""bindingGroup"": ""Keyboard"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<Keyboard>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}");
|
||||
// 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_Dash = m_Gameplay.FindAction("Dash", throwIfNotFound: true);
|
||||
// Menu
|
||||
m_Menu = asset.FindActionMap("Menu", throwIfNotFound: true);
|
||||
m_Menu_Newaction = m_Menu.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();
|
||||
}
|
||||
|
||||
// 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_Dash;
|
||||
public struct GameplayActions
|
||||
{
|
||||
private @PlayerControls m_Wrapper;
|
||||
public GameplayActions(@PlayerControls wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @Move => m_Wrapper.m_Gameplay_Move;
|
||||
public InputAction @Jump => m_Wrapper.m_Gameplay_Jump;
|
||||
public InputAction @Dash => m_Wrapper.m_Gameplay_Dash;
|
||||
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;
|
||||
@Dash.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnDash;
|
||||
@Dash.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnDash;
|
||||
@Dash.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnDash;
|
||||
}
|
||||
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;
|
||||
@Dash.started += instance.OnDash;
|
||||
@Dash.performed += instance.OnDash;
|
||||
@Dash.canceled += instance.OnDash;
|
||||
}
|
||||
}
|
||||
}
|
||||
public GameplayActions @Gameplay => new GameplayActions(this);
|
||||
|
||||
// Menu
|
||||
private readonly InputActionMap m_Menu;
|
||||
private IMenuActions m_MenuActionsCallbackInterface;
|
||||
private readonly InputAction m_Menu_Newaction;
|
||||
public struct MenuActions
|
||||
{
|
||||
private @PlayerControls m_Wrapper;
|
||||
public MenuActions(@PlayerControls wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @Newaction => m_Wrapper.m_Menu_Newaction;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Menu; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(MenuActions set) { return set.Get(); }
|
||||
public void SetCallbacks(IMenuActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_MenuActionsCallbackInterface != null)
|
||||
{
|
||||
@Newaction.started -= m_Wrapper.m_MenuActionsCallbackInterface.OnNewaction;
|
||||
@Newaction.performed -= m_Wrapper.m_MenuActionsCallbackInterface.OnNewaction;
|
||||
@Newaction.canceled -= m_Wrapper.m_MenuActionsCallbackInterface.OnNewaction;
|
||||
}
|
||||
m_Wrapper.m_MenuActionsCallbackInterface = instance;
|
||||
if (instance != null)
|
||||
{
|
||||
@Newaction.started += instance.OnNewaction;
|
||||
@Newaction.performed += instance.OnNewaction;
|
||||
@Newaction.canceled += instance.OnNewaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
public MenuActions @Menu => new MenuActions(this);
|
||||
private int m_GamepadSchemeIndex = -1;
|
||||
public InputControlScheme GamepadScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad");
|
||||
return asset.controlSchemes[m_GamepadSchemeIndex];
|
||||
}
|
||||
}
|
||||
private int m_KeyboardSchemeIndex = -1;
|
||||
public InputControlScheme KeyboardScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_KeyboardSchemeIndex == -1) m_KeyboardSchemeIndex = asset.FindControlSchemeIndex("Keyboard");
|
||||
return asset.controlSchemes[m_KeyboardSchemeIndex];
|
||||
}
|
||||
}
|
||||
public interface IGameplayActions
|
||||
{
|
||||
void OnMove(InputAction.CallbackContext context);
|
||||
void OnJump(InputAction.CallbackContext context);
|
||||
void OnDash(InputAction.CallbackContext context);
|
||||
}
|
||||
public interface IMenuActions
|
||||
{
|
||||
void OnNewaction(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9809c83005b646645b5a20fe90d346e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue