예제 #1
0
        private IEnumerator SpawnAllEnemiesInWave(WaveConfig currentWave)
        {
            var gloabal = GlobalFields.Instans;

            int countEnemy = currentWave.GetNumberOfEnemies();

            yield return(new WaitForSeconds(currentWave.GetDelay()));

            for (int i = 0; i < countEnemy; i++)
            {
                var enemyPrefab = currentWave.GetEnemyPrefab();
                var pos         = currentWave.GetWayPoints()[0].transform.position;
                var holder      = gloabal.GetSpawnHolder();

                var enemyGo = Instantiate(enemyPrefab, pos, Quaternion.identity, holder);
                var enemy   = enemyGo.GetComponent <Enemy>();
                enemy.SetScore(currentWave.GetScore());
                enemy.GetPath().SetWaveConfig(currentWave);
                enemy.SetHealth(currentWave.GetHealth());
                enemy.EnemyShooting.SetShooting(currentWave.GetShooting());
                yield return(new WaitForSeconds(currentWave.GetTiemBetweenSpawn()));
            }
        }
예제 #2
0
 public void SetWaveConfig(WaveConfig config)
 {
     waveConfig = config;
 }