From 0464810f2f83c86560c3422d664380d474cb3e56 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 15 Apr 2024 21:05:01 +0800 Subject: *misc --- .../Assets/TABG/Scripts/Input/InputHandler.cs | 60 ++++++++++++++++++---- .../TABG/Scripts/Input/SetAnimationByInput.cs | 18 ------- .../TABG/Scripts/Input/SetAnimationByInput.cs.meta | 11 ---- 3 files changed, 51 insertions(+), 38 deletions(-) delete mode 100644 ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs delete mode 100644 ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs.meta (limited to 'ActiveRagdoll/Assets/TABG/Scripts/Input') 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(); + } + + 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; + } + } + } + } diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs b/ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs deleted file mode 100644 index 0f0feab..0000000 --- a/ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class SetAnimationByInput : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs.meta b/ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs.meta deleted file mode 100644 index 5f4a2de..0000000 --- a/ActiveRagdoll/Assets/TABG/Scripts/Input/SetAnimationByInput.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 01e4ef433b714c844acfa85d61aa6921 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: -- cgit v1.1-26-g67d0