Exemplo n.º 1
0
 // Spawn the enemies in the associated wave config
 private IEnumerator SpawnEnemiesInWave(WaveScriptableObject waveConfig)
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyController>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetEnemySpawnRate()));
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     waypoints          = waveConfig.GetWaypoints();
     transform.position = waypoints[waypointIndex].transform.position;
 }