Bandidos
|
Public Member Functions | |
Wave (WaveSystem waveSystem, boolean isEnemyKillToEndWave) | |
void | addSection (EnemyFactory.EnemyType enemyType, int amount, float timeForSection) |
int | getCurrentSection () |
int | getTotalSections () |
void | startWave () |
void | updateWave (float dt) |
boolean | isWaveOver () |
void | clean () |
void | onReceiveEvent (Event event) |
boolean | hasSpawnedEntireSection () |
A Wave is something, to design and create wave patterns. These patterns are created by so called 'sections' Before a wave is started by the 'startWave' method, it should be designed using the 'addSection' method NOTE: A wave instance should be updated by calling the 'updateWave' method every frame!
com.mygdx.game.waves.Wave.Wave | ( | WaveSystem | waveSystem, |
boolean | isEnemyKillToEndWave | ||
) |
A wave should be linked to a waveSystem to be able to create enemies.
waveSystem | to create enemies with |
isEnemyKillToEndWave | means, when set on true, the wave will not end until all enemies are killed else it will end by the time given. |
void com.mygdx.game.waves.Wave.addSection | ( | EnemyFactory.EnemyType | enemyType, |
int | amount, | ||
float | timeForSection | ||
) |
This method designs a wave by sections, every section contains an enemyType to spawn, the amount to spawn and the time to clear the section before the other starts. When all wave sections ran out of time, the wave will end if isEnemyKillToEndWave is not set to true, else it will end when all enemies are killed. The last section timeForSection will not be used.
enemyType | to spawn in this section |
amount | of enemies of given type to spawn |
timeForSection | is the time in seconds before the other section starts. |
void com.mygdx.game.waves.Wave.clean | ( | ) |
Cleans the wave from all data it was using, this should be called only when the wave is being prepared for garbage collection
int com.mygdx.game.waves.Wave.getCurrentSection | ( | ) |
Returns the index of the current section
int com.mygdx.game.waves.Wave.getTotalSections | ( | ) |
Returns the total amount of sections in this wave
boolean com.mygdx.game.waves.Wave.hasSpawnedEntireSection | ( | ) |
boolean com.mygdx.game.waves.Wave.isWaveOver | ( | ) |
This returns whether the wave has run out of sections to spawn
void com.mygdx.game.waves.Wave.onReceiveEvent | ( | Event | event | ) |
This will be triggered when an event has been fired of type which this implementing class was listening to.
event | which has one of the event types which is listened to. |
Implements com.mygdx.game.engine.events.IEventReceiver.
void com.mygdx.game.waves.Wave.startWave | ( | ) |
Starts the wave. WARNING: This has no effect if the 'updateWave' is not called every frame!
void com.mygdx.game.waves.Wave.updateWave | ( | float | dt | ) |
Updates the Wave so it can perform the logics it is supposed to do. This should be called every frame in order to work
dt | is the delta which has passed between frames (Delta Time) |