Laser Defender - Tips for more easy variants in Waves

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,


HA! Great minds… Called my variable waveInterval but does the same thing.

Cheap and cheerful way to get more paths for less work. :slight_smile:

Beware if you have paths that end at the bottom of the screen though, as you could unintentionally make the game a lot harder for the player.

I put in a difficulty level for each wave. I then put all my waves in to a ‘bucket’ and pick them out based on difficulty vs how long the game has been going.

Privacy & Terms