示例#1
0
        public void Advance()
        {
            if (_currentWaveIndex >= _spawnWaves.Count)
            {
                return;
            }

            Debug.Log("Advancing NPC wave spawner...");

            // stop the current wave timers
            if (_currentWaveIndex >= 0)
            {
                CurrentWave.Stop();

                WaveCompleteEvent?.Invoke(this, new SpawnWaveEventArgs(_currentWaveIndex, _currentWaveIndex >= _spawnWaves.Count - 1));
            }

            // advance the wave
            _currentWaveIndex++;
            if (_currentWaveIndex >= _spawnWaves.Count)
            {
                return;
            }

            // start the next wave of timers
            CurrentWave.Start();

            WaveStartEvent?.Invoke(this, new SpawnWaveEventArgs(_currentWaveIndex, _currentWaveIndex >= _spawnWaves.Count - 1));
        }
示例#2
0
        private void Run()
        {
            if (_currentWaveIndex >= _spawnWaves.Count)
            {
                return;
            }

            // stop the current wave timers
            if (_currentWaveIndex >= 0)
            {
                CurrentWave.Stop();
                WaveCompleteEvent?.Invoke(this, new SpawnWaveEventArgs(_currentWaveIndex, _currentWaveIndex >= _spawnWaves.Count - 1));
            }

            // advance the wave
            _currentWaveIndex++;
            if (_currentWaveIndex >= _spawnWaves.Count)
            {
                return;
            }

            // start the next wave of timers
            CurrentWave.Start();
            _waveTimer.Start(CurrentWave.Duration);

            WaveStartEvent?.Invoke(this, new SpawnWaveEventArgs(_currentWaveIndex, _currentWaveIndex >= _spawnWaves.Count - 1));
        }