From 793c4eae324d394f19a8bac66a803bf03a67ae9d Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Sat, 16 Mar 2024 12:39:34 +0800 Subject: *misc --- _ActiveRagdoll/InputHandler.cs | 120 ----------------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 _ActiveRagdoll/InputHandler.cs (limited to '_ActiveRagdoll/InputHandler.cs') diff --git a/_ActiveRagdoll/InputHandler.cs b/_ActiveRagdoll/InputHandler.cs deleted file mode 100644 index 27adc82..0000000 --- a/_ActiveRagdoll/InputHandler.cs +++ /dev/null @@ -1,120 +0,0 @@ -using UnityEngine; - -public class InputHandler : MonoBehaviour -{ - public Vector3 inputMovementDirection; - - public Vector3 lastInputDirection; - - public bool isSpringting; - - private WeaponHandler wepaonHandler; - - private MovementDataHandler movementData; - - private WeaponHandler weaponHandler; - - private CameraMovement cameraMovement; - - private PlayerDeath death; - - private HasControl hasControl; - - private MovementHandler movement; - - public bool allowStrafe = true; - - private void Start() - { - death = GetComponent(); - movement = GetComponent(); - wepaonHandler = GetComponent(); - hasControl = GetComponent(); - movementData = GetComponent(); - weaponHandler = GetComponent(); - cameraMovement = GetComponentInChildren(); - } - - private void Update() - { - if ((bool)death && death.dead) - { - return; - } - if (!hasControl || hasControl.hasControl) - { - isSpringting = false; - 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; - } - inputMovementDirection = inputMovementDirection.normalized; - if ((bool)movement && Input.GetKeyDown(KeyCode.Space)) - { - movement.Jump(); - } - if ((bool)weaponHandler) - { - if (weaponHandler.isDualWeilding) - { - if (Input.GetKey(KeyCode.Mouse1)) - { - weaponHandler.HoldAttack(shootWithRightGun: true, ADS: false); - } - if (Input.GetKeyDown(KeyCode.Mouse1)) - { - weaponHandler.PressAttack(shootWithRightGun: true, ADS: false); - } - if (Input.GetKey(KeyCode.Mouse0)) - { - weaponHandler.HoldAttack(shootWithRightGun: false, ADS: false); - } - if (Input.GetKeyDown(KeyCode.Mouse0)) - { - weaponHandler.PressAttack(shootWithRightGun: false, ADS: false); - } - } - else - { - if (Input.GetKey(KeyCode.Mouse1)) - { - cameraMovement.ADS = true; - } - else - { - cameraMovement.ADS = false; - } - if (Input.GetKey(KeyCode.Mouse0)) - { - weaponHandler.HoldAttack(shootWithRightGun: true, cameraMovement.ADS); - } - if (Input.GetKeyDown(KeyCode.Mouse0)) - { - weaponHandler.PressAttack(shootWithRightGun: true, cameraMovement.ADS); - } - } - } - } - if (inputMovementDirection != Vector3.zero) - { - lastInputDirection = inputMovementDirection; - } - } -} -- cgit v1.1-26-g67d0