Implement LocalPlayer.DisableInput
This commit is contained in:
parent
60b109a629
commit
2fb6d279da
@ -25,18 +25,15 @@ namespace NeonTea.Quakeball.Player {
|
||||
|
||||
CrouchAction = new InputAction("crouch", binding: "<Gamepad>/buttonEast");
|
||||
CrouchAction.AddBinding("<Keyboard>/leftShift");
|
||||
CrouchAction.Enable();
|
||||
|
||||
JumpAction = new InputAction("crouch", binding: "<Gamepad>/buttonSouth");
|
||||
JumpAction.AddBinding("<Keyboard>/space");
|
||||
JumpAction.performed += _ => {
|
||||
WantsToJump = true;
|
||||
};
|
||||
JumpAction.Enable();
|
||||
|
||||
LookAction = new InputAction("look", binding: "<Gamepad>/leftStick");
|
||||
LookAction.AddBinding("<Mouse>/delta");
|
||||
LookAction.Enable();
|
||||
|
||||
MoveAction = new InputAction("move", binding: "<Gamepad>/rightStick");
|
||||
MoveAction.AddCompositeBinding("Dpad")
|
||||
@ -44,15 +41,25 @@ namespace NeonTea.Quakeball.Player {
|
||||
.With("Down", "<Keyboard>/s")
|
||||
.With("Left", "<Keyboard>/a")
|
||||
.With("Right", "<Keyboard>/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<Vector2>() * Opts.LookSensitivity;
|
||||
|
Loading…
Reference in New Issue
Block a user