SR WaveManager - Smehi/WaveOne GitHub Wiki

WaveManager is a optional component that can improve your life/workflow, however you can opt to do some of the things WaveManager does yourself.

Properties

Name Description
WaveConfigurators List of all the WaveConfigurator components this WaveManager has a reference to.
SpawnersStarted Read-only Have the spawners started spawning enemies?
AmountSpawnersFinished Read-only How many spawners are finished with their wave?
SpawnersFinished Read-only Have all spawners finished spawning their wave?

Methods

public void StartAllConfigWaves(int wave = -1)

StartAllConfigWaves will go through the complete WaveConfigurator list and start all the spawners for each WaveConfigurator. If referenced by code there is an optional paramenter wave. wave is defaulted to -1 which means that the spawner will keep track of the current wave itself. If you give a custom wave number here the spawner will spawn that wave instead even if it hasn't reached it. However it will not continue from that wave. Instead it will go onto the next wave from where it was. This method will also automatically reset the values of the read-only properties to their default state. I.e. if the spawner is at wave 1 and you start wave 5 the spawner will start spawning enemies from wave 5. When it is done spawning the spawner will set its wave counter to wave 2 instead of wave 6.

public void Example()
{
    WaveManager wm = GetComponent<WaveManager>();

    wm.StartAllConfigWaves();
    // Or
    wm.StartAllConfigWaves(3);
}

public void SpawnerFinished(bool val)

SpawnerFinished is meant to be a method that is hooked onto an event listener. The event is 'Event_SpawnerFinished' which all spawners should have a reference to. This event is fired when the spawner has completed its wave and passes a true which is then picked up by val. Inside this method there is a loop that goes over all WaveConfigurators and checks their spawner states. If the spawner is done, the AmountSpawnersFinished property will be increased by 1 and if the count equals that of the WaveConfigurator references SpawnersFinished is set to true.

⚠️ **GitHub.com Fallback** ⚠️