public void SetWaveConfig(WaveScript waveScript) { _waveScript = waveScript; moveSpeed = waveScript.GetEnemiesSpeed(); waypoints = waveScript.GetWaypoints(); transform.position = waypoints[waypointIndex].position; }
IEnumerator SpawnAllEnemiesOfTheWave(WaveScript waveScript) { for (int i = 0; i < waveScript.GetNumberOfEnemies(); i++) { var enemy = Instantiate( waveScript.GetEnemyPrefab(), waveScript.GetWaypoints()[0].position, Quaternion.identity); enemy.GetComponent <EnemyMovement>().SetWaveConfig(waveScript); yield return(new WaitForSeconds(waveScript.GetTimeBetweenSpawns())); } }