示例#1
0
    private void NextWave()
    {
        waveCount++;
        int enemiesCount = Random.Range(waveCount, waveCount + addEnemy);

        OnNextWave?.Invoke(enemiesCount);
    }
    public void StartSpawning()
    {
        _currentWave++;
        if (_currentWave >= _numberOfWaves)
        {
            _currentWave = _numberOfWaves - 1;
            return;
        }
        else if (_currentWave + 1 == _numberOfWaves)
        {
            _isFinalWave = true;
        }

        _stopSpawningEnemies  = false;
        _stopSpawningPowerUps = false;
        StartCoroutine(SpawnWaveRoutine(_currentWave));
        StartCoroutine("SpawnPowerUpRoutine");
        OnUpdateWaves?.Invoke(_currentWave + 1, _numberOfWaves);
        OnNextWave?.Invoke();
    }