예제 #1
0
    void CheckWave()
    {
        if (waveIndex == waveBundles.Length - 1 && waveCountdown <= 0)
        {
            GameEventSignals.DoLastWaveEnd();
            return;
        }

        waveCountdownTimer += Time.deltaTime;
        if (waveCountdownTimer >= 1.0f)
        {
            waveCountdownTimer = 0;
            --waveCountdown;
            GameEventSignals.DoWaveCountdownUpdated();
        }

        if (waveIndex < waveBundles.Length - 1 && waveCountdown == 0)
        {
            ++waveIndex;
            enemyGroupsIndex = enemiesInGroupIndex = 0;
            enemySpawnTime   = waveBundles[waveIndex].enemySpawnTime;
            waveCountdown    = waveBundles[waveIndex].duration;

            SpawnEnemy.Ins.spawnTimer   = enemySpawnTime;
            SpawnEnemy.Ins.stopSpawning = false;

            GameEventSignals.DoWaveUpdated(waveIndex);
        }
    }
예제 #2
0
    void OnSceneConfigured()
    {
        waveIndex          = enemyGroupsIndex = enemiesInGroupIndex = 0;
        enemySpawnTime     = waveBundles[waveIndex].enemySpawnTime;
        waveCountdown      = waveBundles[waveIndex].duration;
        waveCountdownTimer = 0;

        if (ManageSceneSetup.Ins.enemySpawnerExists)
        {
            SpawnEnemy.Ins.spawnTimer = enemySpawnTime;
        }
        else
        {
            SpawnEnemy.Ins.spawnTimer = SpawnEnemy.Ins.spawnTime;
            disabled.Value            = true;
        }

        GameEventSignals.DoWaveUpdated(waveIndex);
        GameEventSignals.DoWaveCountdownUpdated();
    }