using Rigging.Action; using Rigging.Cameras; using Rigging.Data; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; namespace Rigging.Inputs { public class InputHandler : MonoBehaviour { public Vector3 inputMovementDirection; public Vector3 lastInputDirection; public bool allowStrafe = true; private MovementDataHandler movementData; private Movement movement; public bool isSpringting = false; private void Start() { movementData = GetComponentInChildren(); movement = 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; } if ((bool)movement && Input.GetKeyDown(KeyCode.Space)) { movement.Jump(); } } } }