// Start is called before the first frame update void Start() { // Get the list from ObstacleWave Waypoints = obstacleWave.GetWaypoints(); transform.position = Waypoints[waypointIndex].transform.position; }
private IEnumerator SpawnAllEnemiesInWave(ObstacleWave waveToSpawn) { for (int enemyCount = 1; enemyCount <= waveToSpawn.GetNumberOfEnemies(); enemyCount++) { var newEnemy = Instantiate( waveToSpawn.GetEnemyPrefab(), waveToSpawn.GetWaypoints()[0].transform.position, Quaternion.identity); newEnemy.GetComponent <EnemyPathing>().SetObstacleWave(waveToSpawn); yield return(new WaitForSeconds(waveToSpawn.GetTimeBetweenSpawns())); } }