Commit f3e0b933 by alsunj

Merge branch 'feat/new-input-system' into 'main'

Feat/new input system

See merge request alsunj/loputoo!3
parents f535a480 665dc919
......@@ -15,10 +15,10 @@ public class PlayerAnimator : NetworkBehaviour
private void Update()
{
if (!IsOwner)
{
return;
}
// if (!IsOwner)
// {
// return;
// }
_animator.SetBool(IS_WALKING, _playerController.IsWalking());
}
......
fileFormatVersion: 2
guid: 0343730f57b4d2a48895245cfc7f63b1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System;
using UnityEngine;
public interface IInputHandler
{
event Action<Vector2> MoveEvent;
event Action<Vector2> LookEvent;
event Action InteractEvent;
event Action JumpEvent;
event Action<bool> SprintEvent;
event Action<bool> CrouchEvent;
event Action AttackEvent;
void SimulateMove(Vector2 movement);
void SimulateInteract();
void SimulateSprint(bool isSprinting);
}
\ No newline at end of file
fileFormatVersion: 2
guid: 24d81946a3a22194e90d36523060f029
\ No newline at end of file
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 38046858527cd1b4fa2edbe312d75842, type: 3}
m_Name: InputReader
m_EditorClassIdentifier:
fileFormatVersion: 2
guid: fae963ae99ce6d14d8bbcd54becb58d7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
using System;
using UnityEngine;
using UnityEngine.InputSystem;
[CreateAssetMenu(fileName = "InputReader", menuName = "Scriptable Objects/InputReader")]
public class InputReader : ScriptableObject, InputSystem_Actions.IPlayerActions, IInputHandler
{
private InputSystem_Actions inputActions;
public event Action<Vector2> MoveEvent;
public event Action<Vector2> LookEvent;
public event Action InteractEvent;
public event Action JumpEvent;
public event Action<bool> SprintEvent;
public event Action<bool> CrouchEvent;
public event Action AttackEvent;
public void InitializeInput()
{
if (inputActions == null)
{
inputActions = new InputSystem_Actions();
inputActions.Player.SetCallbacks(this);
}
inputActions.Enable();
}
private void OnDisable()
{
if (inputActions != null)
{
inputActions.Disable();
inputActions.Player.RemoveCallbacks(this);
inputActions.Dispose();
}
}
public void OnMove(InputAction.CallbackContext context)
{
if (context.performed)
{
MoveEvent?.Invoke(context.ReadValue<Vector2>());
}
else
{
MoveEvent?.Invoke(Vector2.zero);
}
}
public void OnLook(InputAction.CallbackContext context)
{
if (context.performed)
{
LookEvent?.Invoke(context.ReadValue<Vector2>());
}
else
{
LookEvent?.Invoke(new Vector2(0, 0));
}
}
public void OnAttack(InputAction.CallbackContext context)
{
if (context.performed)
{
AttackEvent?.Invoke();
}
}
public void OnInteract(InputAction.CallbackContext context)
{
if (context.performed)
{
InteractEvent?.Invoke();
}
}
public void OnCrouch(InputAction.CallbackContext context)
{
if (context.performed)
{
CrouchEvent?.Invoke(true);
}
else
{
CrouchEvent?.Invoke(false);
}
}
public void OnJump(InputAction.CallbackContext context)
{
if (context.performed)
{
JumpEvent?.Invoke();
}
}
public void OnSprint(InputAction.CallbackContext context)
{
if (context.performed)
{
SprintEvent?.Invoke(true);
}
else
{
SprintEvent?.Invoke(false);
}
}
public void SimulateMove(Vector2 movement)
{
throw new NotImplementedException();
}
public void SimulateInteract()
{
throw new NotImplementedException();
}
public void SimulateSprint(bool isSprinting)
{
throw new NotImplementedException();
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 38046858527cd1b4fa2edbe312d75842
\ No newline at end of file
fileFormatVersion: 2
guid: 2e363bf247c9d6d459bcda6fa30f8347
\ No newline at end of file
......@@ -27,7 +27,7 @@
"name": "Attack",
"type": "Button",
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
......@@ -36,7 +36,7 @@
"name": "Interact",
"type": "Button",
"id": "852140f2-7766-474d-8707-702459ba45f3",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "Hold",
"initialStateCheck": false
......@@ -45,7 +45,7 @@
"name": "Crouch",
"type": "Button",
"id": "27c5f898-bc57-4ee1-8800-db469aca5fe3",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
......@@ -54,25 +54,7 @@
"name": "Jump",
"type": "Button",
"id": "f1ba0d36-48eb-4cd5-b651-1c94a6531f70",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Previous",
"type": "Button",
"id": "2776c80d-3c14-4091-8c56-d04ced07a2b0",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Next",
"type": "Button",
"id": "b7230bb6-fc9b-4f52-8b25-f5e19cb2c2ba",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
......@@ -81,7 +63,7 @@
"name": "Sprint",
"type": "Button",
"id": "641cd816-40e6-41b4-8c3d-04687c349290",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
......@@ -321,28 +303,6 @@
},
{
"name": "",
"id": "cbac6039-9c09-46a1-b5f2-4e5124ccb5ed",
"path": "<Keyboard>/2",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Next",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "e15ca19d-e649-4852-97d5-7fe8ccc44e94",
"path": "<Gamepad>/dpad/right",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Next",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f2e9ba44-c423-42a7-ad56-f20975884794",
"path": "<Keyboard>/leftShift",
"interactions": "",
......@@ -409,28 +369,6 @@
},
{
"name": "",
"id": "1534dc16-a6aa-499d-9c3a-22b47347b52a",
"path": "<Keyboard>/1",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Previous",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "25060bbd-a3a6-476e-8fba-45ae484aad05",
"path": "<Gamepad>/dpad/left",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Previous",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "1c04ea5f-b012-41d1-a6f7-02e963b52893",
"path": "<Keyboard>/e",
"interactions": "",
......
......@@ -8,7 +8,7 @@ ScriptedImporter:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 0
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:
fileFormatVersion: 2
guid: 4bdbbb25aff08a54098c34d6f75b201b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -11,6 +11,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/Scene.unity
guid: fb476371a58224b439cbcc569f3d86f0
- enabled: 1
path: Assets/_Game/Scenes/SC.unity
guid: 4bdbbb25aff08a54098c34d6f75b201b
m_configObjects:
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
m_UseUCBPForAssetBundles: 0
......@@ -25,7 +25,7 @@ EditorSettings:
m_AsyncShaderCompilation: 1
m_PrefabModeAllowAutoSave: 1
m_EnterPlayModeOptionsEnabled: 1
m_EnterPlayModeOptions: 0
m_EnterPlayModeOptions: 1
m_GameObjectNamingDigits: 1
m_GameObjectNamingScheme: 0
m_AssetNamingUsesSpace: 1
......
......@@ -945,7 +945,7 @@ PlayerSettings:
qnxGraphicConfPath:
apiCompatibilityLevel: 6
captureStartupLogs: {}
activeInputHandler: 2
activeInputHandler: 1
windowsGamepadBackendHint: 0
cloudProjectId: 3cd49368-e13d-4741-80b2-b4559fc6fe1b
framebufferDepthMemorylessMode: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment