public void CastAbility() { if (abilityCharges > 0 && abilitiesEnabled) { switch (abilityChoice) { case Abilities.rocketBoost: CastRocketBoost(); break; case Abilities.rocketJump: networkCharacter.SetJumpingEffect(); jumpAbility.CastRocketJump(); break; case Abilities.teleport: teleportAbility.CastTeleport(); break; default: Debug.Log("Ability cast, but no ability choice specified"); break; } abilityCharges--; abilityCharges = Mathf.Clamp(abilityCharges, 0, 2); chargeMeter.ClearCharge(); StartCoroutine(AbilityWaitTime()); } }