diff options
author | chai <215380520@qq.com> | 2024-03-16 12:39:34 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2024-03-16 12:39:34 +0800 |
commit | 793c4eae324d394f19a8bac66a803bf03a67ae9d (patch) | |
tree | 629b5d87bdf0fd004b1950e42e2427bc884f1059 /_ActiveRagdoll/InputHandler.cs | |
parent | 3f53966a0fdc96f1e32d7d5f930c5cac6d4dfb29 (diff) |
*misc
Diffstat (limited to '_ActiveRagdoll/InputHandler.cs')
-rw-r--r-- | _ActiveRagdoll/InputHandler.cs | 120 |
1 files changed, 0 insertions, 120 deletions
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<PlayerDeath>(); - movement = GetComponent<MovementHandler>(); - wepaonHandler = GetComponent<WeaponHandler>(); - hasControl = GetComponent<HasControl>(); - movementData = GetComponent<MovementDataHandler>(); - weaponHandler = GetComponent<WeaponHandler>(); - cameraMovement = GetComponentInChildren<CameraMovement>(); - } - - 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; - } - } -} |