void Update() { if (idOfWave == 6) { levelWin.WinGame(); } if (curentTimeOfWave <= wavesScriptableObjects[idOfWave].TimeOfWaves) { curentTimeOfWave += Time.deltaTime; if (cooldown >= wavesScriptableObjects[idOfWave].TimeBeetweenSpaunOfMob) { Instantiate(enemyPrefab, spawnPoint.transform.position, Quaternion.identity); cooldown = 0; } else { cooldown += Time.deltaTime; } } else { idOfWave++; curentTimeOfWave = 0; } }
// Update is called once per frame void Update() { if (count == 15) { winMenu.WinGame(); winSound.SetActive(true); } }
void Die() { hurtSound.SetActive(true); explosionParticle.SetActive(true); EnemiesAlive--; Invoke("Wait", 1); if (EnemiesAlive <= 0) { winSound.SetActive(true); winMenu.WinGame(); } Destroy(gameObject); }