diff --git a/MrBigsock/Assets/Code/PlayerController.cs b/MrBigsock/Assets/Code/PlayerController.cs index 8678df36f42d0f8fa049c41ab23088bd3a39c5b3..35a1d4d707606203db1dba7969eaf55a7aac10e6 100644 --- a/MrBigsock/Assets/Code/PlayerController.cs +++ b/MrBigsock/Assets/Code/PlayerController.cs @@ -212,19 +212,22 @@ namespace BigSock { // Charge: Fire when let go. case FireType.Charge: // If pressed down: Store start time. - if (Input.GetKeyDown(key)) { - ability.ChargeStarted = Time.time; + if(Input.GetKeyDown(key)) { + // Only start charging if the ability is ready. + if(ability.Ability.Ready) ability.ChargeStarted = Time.time; return true; } // If let go: Activate - else if (Input.GetKeyUp(key)) { - par.ChargeTime = ability.ChargeTime; - var t = ability.Ability.Use(par); - if (!t) { - if (par.ChargeTime < ability.Ability.MinCharge) - Debug.Log($"[PlayerController.CheckAbilityInput({key})] {ability.Ability.Name} not fired ({par.ChargeTime:N3} < {ability.Ability.MinCharge:N3})"); + else if(Input.GetKeyUp(key)) { + if(ability.IsCharging) { + par.ChargeTime = ability.ChargeTime; + var t = ability.Ability.Use(par); + if (!t) { + if (par.ChargeTime < ability.Ability.MinCharge) + Debug.Log($"[PlayerController.CheckAbilityInput({key})] {ability.Ability.Name} not fired ({par.ChargeTime:N3} < {ability.Ability.MinCharge:N3})"); + } + ability.ChargeStarted = 0f; // Reset charge time when we release the key. } - ability.ChargeStarted = 0f; // Reset charge time when we release the key. return true; } break;