Make DisableInput an int instead of a bool

This commit is contained in:
Sofia 2020-08-08 16:06:14 +03:00
parent b5cd0233b4
commit 3636f39143
2 changed files with 8 additions and 3 deletions

View File

@ -22,6 +22,7 @@ namespace NeonTea.Quakeball.Interface {
private InputAction ToggleTerminalAction; private InputAction ToggleTerminalAction;
private InputAction SubmitTerminal; private InputAction SubmitTerminal;
private float DesiredTerminalPos; private float DesiredTerminalPos;
private bool OpenUpdated;
private bool IsOpen = false; private bool IsOpen = false;
private Dictionary<string, Func<string[], bool>> Commands = new Dictionary<string, Func<string[], bool>>(); private Dictionary<string, Func<string[], bool>> Commands = new Dictionary<string, Func<string[], bool>>();
@ -90,7 +91,11 @@ namespace NeonTea.Quakeball.Interface {
} }
InputField.readOnly = true; InputField.readOnly = true;
if (Player != null) { if (Player != null) {
Player.DisableInput = IsOpen; if (IsOpen) {
Player.DisableInput += 1;
} else {
Player.DisableInput -= 1;
}
} }
} }

View File

@ -8,7 +8,7 @@ namespace NeonTea.Quakeball.Players {
/// <summary>A controller class for a local player. Handles input and updates the relevant components.</summary> /// <summary>A controller class for a local player. Handles input and updates the relevant components.</summary>
[RequireComponent(typeof(Player))] [RequireComponent(typeof(Player))]
public class LocalPlayer : MonoBehaviour { public class LocalPlayer : MonoBehaviour {
public bool DisableInput = false; public int DisableInput;
public float FullSyncFrequency = 1; public float FullSyncFrequency = 1;
public Player Player { private set; get; } public Player Player { private set; get; }
@ -63,7 +63,7 @@ namespace NeonTea.Quakeball.Players {
} }
private void Update() { private void Update() {
if (DisableInput) { if (DisableInput > 0) {
CrouchAction.Disable(); CrouchAction.Disable();
JumpAction.Disable(); JumpAction.Disable();
LookAction.Disable(); LookAction.Disable();