예제 #1
0
        public WaveTimeline GetWave(int index)
        {
            WaveTimeline timeline = WaveCollection.GetWave(index);

            if (!IsWaveKnown(index))
            {
                OnNewWave?.Invoke(timeline);
                MarkWaveAsKnown(index, true);
            }
            return(timeline);
        }
예제 #2
0
 private void NextWave()
 {
     // if (currentWaveNumber > 0) AudioManager.instance.PlaySound2D("Level Completed");
     currentWaveNumber++;
     if (currentWaveNumber - 1 < waves.Length)
     {
         currentWave             = waves[currentWaveNumber - 1];
         enemiesRemainingToSpawn = currentWave.enemyCount;
         enemiesRemainingAlive   = enemiesRemainingToSpawn;
         OnNewWave?.Invoke(currentWaveNumber);
         ResetPlayerPosition();
     }
 }
예제 #3
0
파일: Spawner.cs 프로젝트: mayank2909/Games
    void NextWave()
    {
        if (currentWaveNumber > 0)
        {
            AudioManager.instance.PlaySound2d("Level Complete");
        }
        currentWaveNumber++;
        currentWave = waves[currentWaveNumber - 1];

        enemiesRemaining      = currentWave.enemyCount;
        enemiesRemainingAlive = enemiesRemaining;

        OnNewWave?.Invoke(currentWaveNumber);
    }
예제 #4
0
 void NextWave()
 {
     if (waveIndex > 0)
     {
         AudioManager.instance.PlaySoundEffect2D("Level Complete");
     }
     waveIndex++;
     if (waveIndex - 1 < waves.Length)
     {
         currentWave             = waves[waveIndex - 1];
         remainingEnemiesToSpawn = currentWave.enemyCount;
         remainingEnemiesAlive   = remainingEnemiesToSpawn;
         OnNewWave?.Invoke(waveIndex);
     }
     nextCampingCheckTime = Time.time + allowedCampingTime;
     resetPlayerPosition();
 }
    private void NextWave()
    {
        if (_currentWaveNumber > 0)
        {
            AudioManager.instance.PlaySound("Level completed");
        }

        _currentWaveNumber++;

        if (_currentWaveNumber - 1 < Waves.Length)
        {
            _currentWave = Waves[_currentWaveNumber - 1];

            _enemiesRemainingToSpawn = _currentWave.EnemyCount;
            _enemiesRemainingAlive   = _enemiesRemainingToSpawn;

            OnNewWave?.Invoke(_currentWaveNumber);

            ResetPlayerPosition();
        }
    }
예제 #6
0
        private void SpawnNextWave()
        {
            waveCounter++;
            //Debug.Log ("SpawnManager:NextWave: wave count: " + waveCounter);

            if (waveCounter - 1 < waves.Length)
            {
                currentWaveInfo  = waves[waveCounter - 1];
                remainingToSpawn = currentWaveInfo.spawnCount;
                remainingToAlive = remainingToSpawn;

                if (OnNewWave != null)
                {
                    OnNewWave.Invoke(waveCounter);
                }
            }
            else
            {
                // End of waves
            }
        }
예제 #7
0
    /// Starts a new wave, displaying a message, and calculating the time for each enemy to spawn
    public IEnumerator StartWave()
    {
        yield return(new WaitForSeconds(_waves[_levelToLoad.Value].waveStartDelay));

        _currentWaveName = _waves[_levelToLoad.Value].waveMessage;

        OnNewWave?.Invoke(_currentWaveName);

        if (_waves[_levelToLoad.Value].spawnInSequence == true)
        {
            _waves[_levelToLoad.Value].spawnTimeTemp = 0;

            foreach (Spawn spawn in _waves[_levelToLoad.Value].spawns)
            {
                spawn.spawnDelay = _waves[_levelToLoad.Value].spawnTimeTemp;

                _waves[_levelToLoad.Value].spawnTimeTemp += spawn.spawnTime * spawn.count;

                spawn.enemiesRemainingToSpawn = spawn.count;
            }
        }
        else
        {
            _waves[_levelToLoad.Value].spawnTimeTemp = _waves[_levelToLoad.Value].spawnTime;

            foreach (Spawn spawn in _waves[_levelToLoad.Value].spawns)
            {
                spawn.spawnDelayTimer = spawn.spawnDelay;
                spawn.spawnTime       = _waves[_levelToLoad.Value].spawnTime / spawn.count;

                spawn.enemiesRemainingToSpawn = spawn.count;
            }

            NextWave();
        }
        _waveIsCleared = false;
    }