Exemplo n.º 1
0
 IEnumerator SpawnAllEnemiesInWave(WaveConfiguration waveConfig)
 {
     for (int i = 0; i < waveConfig.getNumberOfEnemies(); i++)
     {
         var newEnemy = Instantiate(waveConfig.getEnemyPrefab(), waveConfig.getWayPoints()[0].position, Quaternion.identity);
         newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.getTimeBetweenSpawns()));
     }
 }
Exemplo n.º 2
0
    private IEnumerator SpawnAllEnemiesInWave(WaveConfiguration waveConfig)
    {
        for (int enemyCounter = 0; enemyCounter < waveConfig.getNumberOfEnemies(); enemyCounter++)
        {
            GameObject SpawnedEnemy = Instantiate(waveConfig.GetEnemyPrefab() as GameObject, waveConfig.GetWaypoints()[0].position, Quaternion.identity);

            SpawnedEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(waveConfig.getTimeBetweenSpawns()));
        }
    }
Exemplo n.º 3
0
 private IEnumerator spawnEnemiesInWave(WaveConfiguration wave)
 {
     for (int enemyCount = 0; enemyCount < wave.getNumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             wave.getEnemyPreab(),
             wave.getWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyMovement>().setWaveConfig(wave);
         yield return(new WaitForSeconds(wave.getTimeBetweenSpawns()));
     }
 }