Esempio n. 1
0
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemy(); enemyCount++)
     {
         var NewEnemy = Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity);
         NewEnemy.GetComponent <EnemyPathing>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()));
     }
 }
Esempio n. 2
0
 IEnumerator SpawnEnemy()
 {
     for (float num = 0; num < waveConfig.GetNumberOfEnemy(); num++)
     {
         var spawnEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoint()[0].transform.position,
             Quaternion.identity);
         spawnEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
     }
     yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawn()));
 }
Esempio n. 3
0
 //1Wave中ですべての敵をSpawn
 //この関数は単に指定した回数、指定したObjectのInstanceを作成するだけである。
 //Insatanceのその後の挙動には全くタッチしないのでInstanceの挙動自体はEnemyPathスクリプトが行う。
 private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig)
 {
     //waveconfigで設定した敵の数の回数文だけForループを回す
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemy(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetTBSpawn()));
     }
 }
Esempio n. 4
0
    /// <summary>
    /// Spawn the specefic waveconfig to perform enemy movement
    /// </summary>
    /// <param name="wave">The waveconfig thats need to be followed to move an enemy.</param>
    /// <returns></returns>
    private IEnumerator SpawnEnemy(WaveConfig wave)
    {
        for (int i = 0; i < wave.GetNumberOfEnemy(); i++)
        {
            var newEnemy = Instantiate(
                wave.GetEnemyPrefab(),
                wave.GetEnemyWaypoints()[0].transform.position,
                Quaternion.identity);
            newEnemy.GetComponent <EnemyPathing>().waveConfig = wave;

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