summaryrefslogtreecommitdiff
path: root/ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-04-15 21:05:01 +0800
committerchai <215380520@qq.com>2024-04-15 21:05:01 +0800
commit0464810f2f83c86560c3422d664380d474cb3e56 (patch)
tree3548bec2d39f6e2a9803dd02dd2f636922ea07c7 /ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs
parentf34c222b242c6fd01ed209ff827c614621160048 (diff)
*misc
Diffstat (limited to 'ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs')
-rw-r--r--ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs60
1 files changed, 51 insertions, 9 deletions
diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs b/ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs
index bae645b..d32d67d 100644
--- a/ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs
+++ b/ActiveRagdoll/Assets/TABG/Scripts/Input/InputHandler.cs
@@ -1,18 +1,60 @@
+using Rigging.Camera;
+using Rigging.Data;
+using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
+using UnityEngine.Rendering;
-public class InputHandler : MonoBehaviour
+namespace Rigging.Inputs
{
- // Start is called before the first frame update
- void Start()
- {
-
- }
- // Update is called once per frame
- void Update()
+ public class InputHandler : MonoBehaviour
{
-
+ public Vector3 inputMovementDirection;
+
+ public Vector3 lastInputDirection;
+
+ public bool allowStrafe = true;
+
+ private MovementDataHandler movementData;
+
+ public bool isSpringting = false;
+
+ private void Start()
+ {
+ movementData = GetComponentInChildren<MovementDataHandler>();
+ }
+
+ private void Update()
+ {
+ inputMovementDirection = Vector3.zero;
+ if (Input.GetKey(KeyCode.W))
+ {
+ inputMovementDirection += movementData.groundedForward;
+ }
+ if (Input.GetKey(KeyCode.S))
+ {
+ inputMovementDirection += movementData.groundedBack;
+ }
+ if (Input.GetKey(KeyCode.D) && allowStrafe)
+ {
+ inputMovementDirection += movementData.right;
+ }
+ if (Input.GetKey(KeyCode.A) && allowStrafe)
+ {
+ inputMovementDirection += movementData.left;
+ }
+ //if (Input.GetKey(KeyCode.LeftShift) && (!cameraMovement || !cameraMovement.ADS))
+ //{
+ // isSpringting = true;
+ //}
+ if (inputMovementDirection != Vector3.zero)
+ {
+ lastInputDirection = inputMovementDirection;
+ }
+ }
+
}
+
}