private void SpawnCluster(WaveConfig waveConfig)
    {
        //spawns all enemies in the wave at once in a circular cluster shape
        for (int i = 0; i < waveConfig.NumberOfEnemies(); i++)
        {
            //Get a random normalized direction so that the cluster shape is circular instead of a square.
            var randomLocation = new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f)).normalized;

            //Get random radius from 0 to the max radius in the waveconfig. this will make the enemies spawn anywhere within the max radius.
            var spawnLocation = spawnPoints[waveConfig.SpawnPoint()].transform.position + randomLocation * UnityEngine.Random.Range(0, waveConfig.ClusterRadius());

            Instantiate(waveConfig.EnemyPrefab(), spawnLocation, waveConfig.EnemyPrefab().transform.rotation);
        }
    }
 private IEnumerator SpawnEnemiesInWave(WaveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.NumberOfEnemies(); i++)
     {
         //spawn enemies in a stream, delay between spawns is taken from wave config
         Instantiate(waveConfig.EnemyPrefab(), spawnPoints[waveConfig.SpawnPoint()].transform.position, waveConfig.EnemyPrefab().transform.rotation);
         yield return(new WaitForSeconds(waveConfig.TimeBetweenSpawns()));
     }
 }