Hi, just to share an idea to simply make more variants of the same Waveconfig, you could use a bool to set up a Reversemethod, its a great and easy effect:
// In File WaveConfig you need:
[SerializeField] bool pathReverseState = false;
public bool GetPathReverseState() { return pathReverseState; }
// In File EnemyPathing Start Method you need an IF Structure to check for the bool and then reverse:
private void Start()
{
wayPoints = waveConfig.GetWayPoints();
if (waveConfig.GetPathReverseState()) wayPoints.Reverse();
transform.position = wayPoints[0].transform.position;
}
Else to optimize the spawntimes between EnemyWaves I have define a configurable Timer between the Waves
In File WaveConfig.cs you need:
[SerializeField] float timeOfWaveDelay = 0f;
public float GetTimeOfWaveDelay() { return timeOfWaveDelay; }
// In File EnemySpawner you need in your SpawnAllWaves Method the following line,
// yield return new WaitForSeconds(currentWave.GetTimeOfWaveDelay());
// so it looks like:
private IEnumerator SpawnAllWaves()
{
for (int numberOfWave = startingWave; numberOfWave < waveConfigs.Count; numberOfWave++)
{
var currentWave = waveConfigs[numberOfWave];
yield return SpawnAllEnemiesFromWave(currentWave);
yield return new WaitForSeconds(currentWave.GetTimeOfWaveDelay());
}
}
What Do you think? Have you found out other little tweek for optimization?
Have fun,
Magroll