void Hit() { switch (selfTower.type) { case (int)TowerType.FIRST_TOWER: target.GetComponent <Enemy>().TakeDamage(selfProjectile.damage * multi.getDamageMulti("DefaultTower")); break; case (int)TowerType.SECOND_TOWER: target.GetComponent <Enemy>().StartSlow(3); target.GetComponent <Enemy>().TakeDamage(selfProjectile.damage * multi.getDamageMulti("SlowingTower")); break; case (int)TowerType.THIRD_TOWER: target.GetComponent <Enemy>().TakeDamage(selfProjectile.damage * multi.getDamageMulti("RapidTower")); break; case (int)TowerType.FOURTH_TOWER: target.GetComponent <Enemy>().TakeDamage(selfProjectile.damage * multi.getDamageMulti("SniperTower")); break; case (int)TowerType.FIFTH_TOWER: string[] enemyTags = { "DefaultMutant", "FastMutant", "HeavyMutant", "BossMutant" }; foreach (string tag in enemyTags) { GameObject[] enemy = GameObject.FindGameObjectsWithTag(tag); for (int i = 0; i < enemy.Length; i++) { float CurrDistance = Vector2.Distance(transform.position, enemy[i].transform.position); if (CurrDistance <= 1.5f) { enemy[i].GetComponent <Enemy>().TakeDamage(selfProjectile.damage * multi.getDamageMulti("AoeTower")); } } } break; } Destroy(gameObject); }
//Активаня спосбность инженера 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]); } }