private IEnumerator BoostAbilityCooldown() { if (_vehicleInput != null) {//ability is on cooldown, update UI boostBrightIcon.SetActive(false); boostBrightHex.SetActive(false); } float tempTime = 0; while (tempTime < boostAbilityRecharge) { tempTime += Time.deltaTime; if (_vehicleInput != null) { boostFillBar.fillAmount = tempTime / boostAbilityRecharge; } yield return(null); } if (_vehicleInput != null) {//ability is back online, update UI boostBrightIcon.SetActive(true); boostBrightHex.SetActive(true); AudioManager.instance.PlayWithoutSpatial("Ability Recharge"); } _canBoost = true; boostAbility.AbilityOffOfCooldown(); }
// Countdown timer until reuse allowed for abilites that need a cooldown private IEnumerator DefensiveAbilityCooldown() { if (_vehicleInput != null) {//ability is back on cooldown, update UI defensiveBrightIcon.SetActive(false); defensiveBrightHex.SetActive(false); } float tempTime = 0; while (tempTime < defensiveAbilityRecharge) { tempTime += Time.deltaTime; if (_vehicleInput != null) { defensiveAbilityFillAmount.fillAmount = tempTime / defensiveAbilityRecharge; } yield return(null); } if (_vehicleInput != null) {//ability is back online, update UI defensiveBrightIcon.SetActive(true); defensiveBrightHex.SetActive(true); AudioManager.instance.PlayWithoutSpatial("Ability Recharge"); } _canUseDefensiveAbility = true; defensiveAbility.AbilityOffOfCooldown(); }
// Countdown timer until reuse allowed for abilites that need a cooldown private IEnumerator DefensiveAbilityCooldown() { float tempTime = 0; while (tempTime < defensiveAbilityRecharge) { tempTime += Time.deltaTime; yield return(null); } defensiveAbility.AbilityOffOfCooldown(); tempTime = 0; while (tempTime < durationAfterCooldown) { tempTime += Time.deltaTime; yield return(null); } _canUseDefensiveAbility = true; }
private IEnumerator BoostAbilityCooldown() { float tempTime = 0; while (tempTime < boostAbilityRecharge) { tempTime += Time.deltaTime; yield return(null); } boostAbility.AbilityOffOfCooldown(); tempTime = 0; while (tempTime < durationAfterCooldown) { tempTime += Time.deltaTime; yield return(null); } _canBoost = true; }