Commit d4490503 by alsunj

integrate new input system with playeractions map

parent f8f09eef
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
using System;
using UnityEngine;
using UnityEngine.InputSystem;
[CreateAssetMenu(fileName = "InputReader", menuName = "Scriptable Objects/InputReader")]
public class InputReader : ScriptableObject, InputSystem_Actions.IPlayerActions, IInputHandler
{
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 OnMove(InputAction.CallbackContext context)
{
if (context.performed)
{
MoveEvent?.Invoke(context.ReadValue<Vector2>());
}
else
{
MoveEvent?.Invoke(new Vector2(0, 0));
}
}
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:
......@@ -360,7 +360,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &303522003
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -1107,6 +1107,67 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1302162792
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalPosition.x
value: 0.31110024
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalPosition.y
value: -0.71455526
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalPosition.z
value: 0.017542608
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2637631208202168134, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3519263382209774307, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: GlobalObjectIdHash
value: 1048055298
objectReference: {fileID: 0}
- target: {fileID: 7039287367920326276, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 702bb31d143eeaa4792be36b28160445, type: 3}
--- !u!1 &1504492729
GameObject:
m_ObjectHideFlags: 0
......@@ -1718,3 +1779,4 @@ SceneRoots:
- {fileID: 1687222685}
- {fileID: 303522006}
- {fileID: 865924118}
- {fileID: 1302162792}
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