Bandidos
Classes | Public Member Functions | List of all members
com.mygdx.game.waves.Wave Class Reference
Inheritance diagram for com.mygdx.game.waves.Wave:
com.mygdx.game.engine.events.IEventReceiver

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 ()
 

Detailed Description

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!

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ Wave()

com.mygdx.game.waves.Wave.Wave ( WaveSystem  waveSystem,
boolean  isEnemyKillToEndWave 
)

A wave should be linked to a waveSystem to be able to create enemies.

Parameters
waveSystemto create enemies with
isEnemyKillToEndWavemeans, when set on true, the wave will not end until all enemies are killed else it will end by the time given.

Member Function Documentation

◆ addSection()

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.

Parameters
enemyTypeto spawn in this section
amountof enemies of given type to spawn
timeForSectionis the time in seconds before the other section starts.

◆ clean()

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

◆ getCurrentSection()

int com.mygdx.game.waves.Wave.getCurrentSection ( )

Returns the index of the current section

Returns
Index of current section

◆ getTotalSections()

int com.mygdx.game.waves.Wave.getTotalSections ( )

Returns the total amount of sections in this wave

Returns
Lengths of the list of all sections given

◆ hasSpawnedEntireSection()

boolean com.mygdx.game.waves.Wave.hasSpawnedEntireSection ( )

◆ isWaveOver()

boolean com.mygdx.game.waves.Wave.isWaveOver ( )

This returns whether the wave has run out of sections to spawn

Returns
If the wave is out of sections to spawn, true if it is and false if it is still actively working with its sections

◆ onReceiveEvent()

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.

Parameters
eventwhich has one of the event types which is listened to.

Implements com.mygdx.game.engine.events.IEventReceiver.

◆ startWave()

void com.mygdx.game.waves.Wave.startWave ( )

Starts the wave. WARNING: This has no effect if the 'updateWave' is not called every frame!

◆ updateWave()

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

Parameters
dtis the delta which has passed between frames (Delta Time)

The documentation for this class was generated from the following file: