浏览代码

Character control refactoring

/main
Ciro Continisio 4 年前
当前提交
b8b709a6
共有 9 个文件被更改,包括 543 次插入78 次删除
  1. 188
      Assets/Scenes/CharController.unity
  2. 29
      Assets/Scripts/Protagonist.cs
  3. 130
      Assets/Settings/Input/GameInput.cs
  4. 120
      Assets/Settings/Input/GameInput.inputactions
  5. 2
      ProjectSettings/QualitySettings.asset
  6. 2
      Assets/Scripts/InputReader.cs.meta
  7. 88
      Assets/Scripts/InputReader.cs
  8. 62
      Assets/Tests/Input/InputTesting.cs
  9. 0
      /Assets/Scripts/InputReader.cs.meta

188
Assets/Scenes/CharController.unity


m_Children:
- {fileID: 2020721999}
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &308908774
GameObject:

m_LocalScale: {x: 5.7737727, y: 1.8967, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: -4.806, y: 0, z: -11.375001}
--- !u!1 &353533559
GameObject:

m_LocalScale: {x: 4.8320527, y: 1, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &695792052
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 695792053}
m_Layer: 0
m_Name: --------- MANAGERS -------
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &695792053
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 695792052}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &716155109
GameObject:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &804472773
GameObject:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 6
--- !u!1 &826602623
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 826602624}
m_Layer: 0
m_Name: --------- LIGHTING -------
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &826602624
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 826602623}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &955504286
GameObject:
m_ObjectHideFlags: 0

m_LocalScale: {x: 12.044, y: 1, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1069143686
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1069143687}
m_Layer: 0
m_Name: --------- CAMERA WORK -------
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1069143687
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069143686}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1303725911
GameObject:

m_LocalScale: {x: 9.785265, y: 1.1941, z: 1.4703052}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1523164311
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1523164312}
m_Layer: 0
m_Name: --------- GAMEPLAY -------
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1523164312
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1523164311}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1567022179
GameObject:

m_LocalScale: {x: 5.7737727, y: 1.8967, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 14
--- !u!1 &1724036686
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1724036688}
- component: {fileID: 1724036687}
m_Layer: 0
m_Name: InputReader
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1724036687
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1724036686}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 143f1e276019d54448855eb41708d190, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1724036688
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1724036686}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1961065787
GameObject:
m_ObjectHideFlags: 0

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1961065791
MonoBehaviour:

m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: inputReader
value:
objectReference: {fileID: 1724036687}
- target: {fileID: 3341179906418240709, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_Name

- target: {fileID: 3341179906418240731, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_RootOrder
value: 3
value: 8
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240731, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}

29
Assets/Scripts/Protagonist.cs


using System.Collections;
using System;
using System.Collections;
public InputReader inputReader;
//Adds listeners for events being triggered in the InputReader script
private void OnEnable()
{
inputReader.jumpEvent += OnJump;
inputReader.moveEvent += OnMove;
//...
}
//Removes all listeners to the events coming from the InputReader script
private void OnDisable()
{
//...
}
private void OnMove(Vector2 movement)
{
Debug.Log("Move " + movement);
}
private void OnJump()
{
Debug.Log("JUMP");
}
}

130
Assets/Settings/Input/GameInput.cs


""name"": ""Move"",
""type"": ""Value"",
""id"": ""103cf56a-d357-491a-8559-592da00641cc"",
""expectedControlType"": ""Analog"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
},

""type"": ""Button"",
""id"": ""1b6ae4df-f5e6-42fc-92b6-3dcc2e126563"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""RotateCamera"",
""type"": ""Value"",
""id"": ""1c4a88b5-2474-4e49-8f10-f987bde2dee0"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
}

""action"": ""ExtraAction"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""Gamepad Right Stick"",
""id"": ""e79b614b-8728-470d-91bc-53102c8434f5"",
""path"": ""2DVector(mode=2)"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateCamera"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""4e483eb2-4460-4dc1-af9f-9bcb31ebe837"",
""path"": ""<Gamepad>/rightStick/up"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""edb40e4a-ef86-4338-904b-522590bc3cb0"",
""path"": ""<Gamepad>/rightStick/down"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""398710b9-e1a8-4e26-8651-8e3ae6eb3b6e"",
""path"": ""<Gamepad>/rightStick/left"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""597d020e-c169-4232-a603-7e5e35ce0c55"",
""path"": ""<Gamepad>/rightStick/right"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""Keyboard TFGH"",
""id"": ""8e17360e-f036-4963-93f6-05d14787dfb5"",
""path"": ""2DVector"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateCamera"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""9a4ec3f5-78bf-4f42-b7d7-f1edd7ce12dc"",
""path"": ""<Keyboard>/t"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""5d82874e-55d8-4d54-84f5-c4d59dc3b39c"",
""path"": ""<Keyboard>/g"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""13a13bd5-f4ec-4f5b-9a8e-ef1165cc9f5f"",
""path"": ""<Keyboard>/f"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""78626b57-196b-4f24-9a3f-af2477d3633b"",
""path"": ""<Keyboard>/h"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,
""isPartOfComposite"": true
}
]
},

m_Gameplay_Interact = m_Gameplay.FindAction("Interact", throwIfNotFound: true);
m_Gameplay_Pause = m_Gameplay.FindAction("Pause", throwIfNotFound: true);
m_Gameplay_ExtraAction = m_Gameplay.FindAction("ExtraAction", throwIfNotFound: true);
m_Gameplay_RotateCamera = m_Gameplay.FindAction("RotateCamera", throwIfNotFound: true);
// Menus
m_Menus = asset.FindActionMap("Menus", throwIfNotFound: true);
}

private readonly InputAction m_Gameplay_Interact;
private readonly InputAction m_Gameplay_Pause;
private readonly InputAction m_Gameplay_ExtraAction;
private readonly InputAction m_Gameplay_RotateCamera;
public struct GameplayActions
{
private @GameInput m_Wrapper;

public InputAction @Interact => m_Wrapper.m_Gameplay_Interact;
public InputAction @Pause => m_Wrapper.m_Gameplay_Pause;
public InputAction @ExtraAction => m_Wrapper.m_Gameplay_ExtraAction;
public InputAction @RotateCamera => m_Wrapper.m_Gameplay_RotateCamera;
public InputActionMap Get() { return m_Wrapper.m_Gameplay; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }

@ExtraAction.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnExtraAction;
@ExtraAction.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnExtraAction;
@ExtraAction.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnExtraAction;
@RotateCamera.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnRotateCamera;
@RotateCamera.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnRotateCamera;
@RotateCamera.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnRotateCamera;
}
m_Wrapper.m_GameplayActionsCallbackInterface = instance;
if (instance != null)

@ExtraAction.started += instance.OnExtraAction;
@ExtraAction.performed += instance.OnExtraAction;
@ExtraAction.canceled += instance.OnExtraAction;
@RotateCamera.started += instance.OnRotateCamera;
@RotateCamera.performed += instance.OnRotateCamera;
@RotateCamera.canceled += instance.OnRotateCamera;
}
}
}

void OnInteract(InputAction.CallbackContext context);
void OnPause(InputAction.CallbackContext context);
void OnExtraAction(InputAction.CallbackContext context);
void OnRotateCamera(InputAction.CallbackContext context);
}
public interface IMenusActions
{

120
Assets/Settings/Input/GameInput.inputactions


"name": "Move",
"type": "Value",
"id": "103cf56a-d357-491a-8559-592da00641cc",
"expectedControlType": "Analog",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},

"type": "Button",
"id": "1b6ae4df-f5e6-42fc-92b6-3dcc2e126563",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "RotateCamera",
"type": "Value",
"id": "1c4a88b5-2474-4e49-8f10-f987bde2dee0",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}

"action": "ExtraAction",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "Gamepad Right Stick",
"id": "e79b614b-8728-470d-91bc-53102c8434f5",
"path": "2DVector(mode=2)",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateCamera",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "4e483eb2-4460-4dc1-af9f-9bcb31ebe837",
"path": "<Gamepad>/rightStick/up",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "edb40e4a-ef86-4338-904b-522590bc3cb0",
"path": "<Gamepad>/rightStick/down",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "398710b9-e1a8-4e26-8651-8e3ae6eb3b6e",
"path": "<Gamepad>/rightStick/left",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "597d020e-c169-4232-a603-7e5e35ce0c55",
"path": "<Gamepad>/rightStick/right",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Keyboard TFGH",
"id": "8e17360e-f036-4963-93f6-05d14787dfb5",
"path": "2DVector",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateCamera",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "9a4ec3f5-78bf-4f42-b7d7-f1edd7ce12dc",
"path": "<Keyboard>/t",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "5d82874e-55d8-4d54-84f5-c4d59dc3b39c",
"path": "<Keyboard>/g",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "13a13bd5-f4ec-4f5b-9a8e-ef1165cc9f5f",
"path": "<Keyboard>/f",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "78626b57-196b-4f24-9a3f-af2477d3633b",
"path": "<Keyboard>/h",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,
"isPartOfComposite": true
}
]
},

2
ProjectSettings/QualitySettings.asset


skinWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
antiAliasing: 2
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1

2
Assets/Scripts/InputReader.cs.meta


fileFormatVersion: 2
guid: 7d535e31c73ba5849911dab5121f96bb
guid: 143f1e276019d54448855eb41708d190
MonoImporter:
externalObjects: {}
serializedVersion: 2

88
Assets/Scripts/InputReader.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Events;
public class InputReader : MonoBehaviour, GameInput.IGameplayActions
{
public UnityAction jumpEvent;
public UnityAction attackEvent;
public UnityAction interactEvent;
public UnityAction extraActionEvent;
public UnityAction pauseEvent;
public UnityAction<Vector2> moveEvent;
public UnityAction<Vector2> cameraMoveEvent;
GameInput gameInput;
private void OnEnable()
{
if(gameInput == null)
{
gameInput = new GameInput();
gameInput.Gameplay.SetCallbacks(this);
}
gameInput.Gameplay.Enable();
//Debug.Log("I'm enabled");
}
private void OnDisable()
{
gameInput.Gameplay.Disable();
}
public void OnAttack(InputAction.CallbackContext context)
{
if(attackEvent != null
&& context.phase == InputActionPhase.Started)
attackEvent.Invoke();
}
public void OnExtraAction(InputAction.CallbackContext context)
{
if(extraActionEvent != null
&& context.phase == InputActionPhase.Started)
extraActionEvent.Invoke();
}
public void OnInteract(InputAction.CallbackContext context)
{
if(interactEvent != null
&& context.phase == InputActionPhase.Started)
interactEvent.Invoke();
}
public void OnJump(InputAction.CallbackContext context)
{
if(jumpEvent != null
&& context.phase == InputActionPhase.Started)
jumpEvent.Invoke();
}
public void OnMove(InputAction.CallbackContext context)
{
if(moveEvent != null
&& context.phase == InputActionPhase.Performed)
{
moveEvent.Invoke(context.ReadValue<Vector2>());
}
}
public void OnPause(InputAction.CallbackContext context)
{
if(pauseEvent != null
&& context.phase == InputActionPhase.Started)
pauseEvent.Invoke();
}
public void OnRotateCamera(InputAction.CallbackContext context)
{
if(cameraMoveEvent != null
&& context.phase == InputActionPhase.Performed)
{
cameraMoveEvent.Invoke(context.ReadValue<Vector2>());
}
}
}

62
Assets/Tests/Input/InputTesting.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class InputTesting : MonoBehaviour, GameInput.IGameplayActions
{
GameInput gameInput;
private void OnEnable()
{
if(gameInput == null)
{
gameInput = new GameInput();
gameInput.Gameplay.SetCallbacks(this);
}
gameInput.Gameplay.Enable();
Debug.Log("I'm enabled");
}
private void OnDisable()
{
gameInput.Gameplay.Disable();
}
public void OnAttack(InputAction.CallbackContext context)
{
if(context.phase == InputActionPhase.Started)
Debug.Log("Attack");
}
public void OnExtraAction(InputAction.CallbackContext context)
{
if(context.phase == InputActionPhase.Started)
Debug.Log("ExtraAction");
}
public void OnInteract(InputAction.CallbackContext context)
{
if(context.phase == InputActionPhase.Started)
Debug.Log("Interact");
}
public void OnJump(InputAction.CallbackContext context)
{
if(context.phase == InputActionPhase.Started)
Debug.Log("Jump");
}
public void OnMove(InputAction.CallbackContext context)
{
if(context.phase == InputActionPhase.Performed)
Debug.Log("Move " + context.ReadValue<Vector2>());
}
public void OnPause(InputAction.CallbackContext context)
{
if(context.phase == InputActionPhase.Started)
Debug.Log("Pause");
}
}

/Assets/Tests/Input/InputTesting.cs.meta → /Assets/Scripts/InputReader.cs.meta

正在加载...
取消
保存