コード例 #1
0
 private IEnumerator SpawnEnemyWave(Waveconfig wave)
 {
     for (int i = 0; i < wave.GetNumberOfEnemies(); i++)
     {
         Instantiate(
             wave.GetEnemy(),
             transform.position,
             Quaternion.identity);
         yield return(new WaitForSeconds(wave.GetSpawnTime()));
     }
     yield return(new WaitForSeconds(wave.GetSpawnDuration()));
 }
コード例 #2
0
ファイル: EnemySpawner.cs プロジェクト: 0bman/laser_defender
    private IEnumerator SpawnAllEnemiesInWave(Waveconfig waveConfig)
    {
        for (int index = 0; index < waveConfig.GetNumberOfEnemies(); index++)
        {
            var newEnemy = Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWaypoints()[0].transform.position,
                Quaternion.identity);

            newEnemy.GetComponent <Enemy>().SetWaveConfig(waveConfig);

            yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
        }
    }