示例#1
0
 private void SpawnWave()
 {
     remainingEnemySpawnAmount = 5 + 3 * waveNumber;
     state = State.SpawningWave;
     waveNumber++;
     OnWaveNumberChanged?.Invoke(this, EventArgs.Empty);
 }
示例#2
0
 private void SpawnWave()
 {
     _enemiesToSpawn  = startingWaveSize + _waveNumber * waveMultiplier;
     _enemySpawnTimer = timeToSpawnEnemy;
     _state           = State.SpawningWave;
     _waveNumber++;
     OnWaveNumberChanged?.Invoke(this, EventArgs.Empty);
 }
示例#3
0
        private void SpawnWave()
        {
            m_remainingEnemySpawnAmount = m_fixedEnemySpawnAmount + m_scaledEnemySpawnCount * m_waveNumber;
            m_state = State.SpawningWave;

            m_waveNumber++;
            OnWaveNumberChanged?.Invoke(this, EventArgs.Empty);
        }
示例#4
0
 private void SpawnWave()
 {
     _timeToSpawnNextWave -= Time.deltaTime;
     if (_timeToSpawnNextWave < 0f)
     {
         _enemiesToSpawnCount = 3 + 2 * _waveNumber;
         _state = State.SpawningWave;
         _waveNumber++;
         OnWaveNumberChanged?.Invoke(this, EventArgs.Empty);
     }
 }
示例#5
0
    private IEnumerator SpawnWave()
    {
        // Endgame check
        if (waveNumber <= 35)
        {
            currentSpawnRate = betweenSpawns;
        }
        else
        {
            currentSpawnRate = endgameBetweenSpawns;
        }

        // Stop Timer
        nextWaveSpawnTimer = int.MaxValue;

        // Spawer
        for (int i = 0; i < (baseWaveEnemies + waveIncreaser * waveNumber); i++)
        {
            randomPositionMultiplier.x = Random.Range(-spaceOffset, spaceOffset);
            randomPositionMultiplier.y = Random.Range(-spaceOffset, spaceOffset);
            Enemy.Create(nextAttackFrom + randomPositionMultiplier);

            yield return(new WaitForSeconds(currentSpawnRate));
        }

        // Cleanup
        waveNumber++;
        OnWaveNumberChanged?.Invoke(this, System.EventArgs.Empty);
        nextAttackFrom = spawnPositions[UtilitiesClass
                                        .GetRandomArrayIndex(spawnPositions.Count)];
        waveCircleTrans.position = nextAttackFrom;

        // New timer
        nextWaveSpawnTimer =
            Time.timeSinceLevelLoad +
            Mathf.Clamp(20 - Mathf.FloorToInt(waveNumber / 2), 5, 20);
    }