diff --git a/Assets/Scripts/Player/LocalPlayer.cs b/Assets/Scripts/Player/LocalPlayer.cs index 5b75fce..1913b8b 100644 --- a/Assets/Scripts/Player/LocalPlayer.cs +++ b/Assets/Scripts/Player/LocalPlayer.cs @@ -25,18 +25,15 @@ namespace NeonTea.Quakeball.Player { CrouchAction = new InputAction("crouch", binding: "/buttonEast"); CrouchAction.AddBinding("/leftShift"); - CrouchAction.Enable(); JumpAction = new InputAction("crouch", binding: "/buttonSouth"); JumpAction.AddBinding("/space"); JumpAction.performed += _ => { WantsToJump = true; }; - JumpAction.Enable(); LookAction = new InputAction("look", binding: "/leftStick"); LookAction.AddBinding("/delta"); - LookAction.Enable(); MoveAction = new InputAction("move", binding: "/rightStick"); MoveAction.AddCompositeBinding("Dpad") @@ -44,15 +41,25 @@ namespace NeonTea.Quakeball.Player { .With("Down", "/s") .With("Left", "/a") .With("Right", "/d"); - MoveAction.Enable(); - } - - private void Start() { - Cursor.visible = false; - Cursor.lockState = CursorLockMode.Locked; } private void Update() { + if (DisableInput) { + CrouchAction.Disable(); + JumpAction.Disable(); + LookAction.Disable(); + MoveAction.Disable(); + Cursor.lockState = CursorLockMode.None; + Cursor.visible = true; + } else { + CrouchAction.Enable(); + JumpAction.Enable(); + LookAction.Enable(); + MoveAction.Enable(); + Cursor.visible = false; + Cursor.lockState = CursorLockMode.Locked; + } + OptionsData Opts = Options.Get(); Vector2 LookInput = LookAction.ReadValue() * Opts.LookSensitivity;