//Активаня спосбность инженера IEnumerator openCore() { Debug.Log("Я у мамы инженер"); //Получаем старые значения множителей for (int i = 0; i < towerMulti.Length; i++) { previousMultiDamage[i] = multi.getDamageMulti(towerMulti[i]); previousMultiReload[i] = multi.getReloadMulti(towerMulti[i]); } //Увеличиваем их на n времени for (int i = 0; i < towerMulti.Length; i++) { multi.setDamageMulti(2f * previousMultiDamage[i], towerMulti[i]); multi.setReloadMulti(0.5f * previousMultiReload[i], towerMulti[i]); } yield return(new WaitForSecondsRealtime(10)); // //Возвращаем их обратно for (int i = 0; i < towerMulti.Length; i++) { multi.setDamageMulti(previousMultiDamage[i], towerMulti[i]); multi.setReloadMulti(previousMultiReload[i], towerMulti[i]); } }
void Shoot(Transform enemy) { audio.Play(); selfTower[level].CurrCooldown = selfTower[level].Cooldown * multi.getReloadMulti(gameObject.tag); GameObject proj = Instantiate(Projectile); proj.GetComponent <TowerProjectileScr>().selfTower = selfTower[level]; proj.GetComponent <TowerProjectileScr>().level = level; proj.transform.position = transform.position; proj.GetComponent <TowerProjectileScr>().SetTarget(enemy); }