Beispiel #1
0
    void Update()
    {
        if (state == SpawnState.WAITING)
        {
            if (!EnemyIsAlive())
            {
                WaveCompleted();
                WaveNotifier.IncrementWave();
                upgradeMenu.EnableUpgradeButton();
                fade.FadeIn();
            }
            else
            {
                // If there are enemies alive, no need to run the rest of the Update() code
                return;
            }
        }

        if (waveCountDown <= 0)
        {
            if (state != SpawnState.SPAWNING)
            {
                if (!testSpawns)
                {
                    StartCoroutine(SpawnWave(waves[nextWaveIndex]));
                }
            }
        }
        else
        {
            waveCountDown -= Time.deltaTime;
        }
    }