private void Update() { ingameTime += Time.deltaTime; //Difficulty Rises if (difficultyRiseCountdown > 0) { difficultyRiseCountdown -= Time.deltaTime; } else { RiseInDifficulty(); } //Counting down to fire if (turretFireCountdownTimer > 0) { turretFireCountdownTimer -= Time.deltaTime; } else { while (turretFireCountdownTimer != turretFireCooldown) { //Pick a random turret to shoot from int listIndexNumber = Random.Range(0, turrets.Count); GameObject turretToFire = turrets[listIndexNumber]; TurretController turretControllerScript = turretToFire.GetComponent <TurretController>(); //Check if turret is already charging, if so pick another if (turretControllerScript.isCharging == false) { turretControllerScript.ChargeUp(); turretFireCountdownTimer = turretFireCooldown; } } } }