Class FloodingGenerator
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.areas.MapGenerator.FloodingGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionFlag for 100% completeFlag for 20% completeFlag for 40% completeFlag for 60% completeFlag for 80% completeFlooding timer to signal flooding event. -
Constructor Summary
ConstructorsConstructorDescriptionFloodingGenerator
(AtlantisTerrainFactory atlantisTerrainFactory, AtlantisGameArea atlantisGameArea) Creates the entity that manages flooding for the game. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Create the component in the game.void
dispose()
Remove the entity from the game.void
Sets all completion flags to false.void
setFlags()
Sets flags from the internal timer flags.void
Starts the countdown for flooding to occur.void
Flashes tiles that will be flooded on the next iteration.void
Algorithm that determines which tiles to be flooded on the next flooding event.void
update()
To be called each time update is called.Updates the internal flag logic.Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, isAnimationRenderComponent, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Field Details
-
timer
Flooding timer to signal flooding event. -
status20p
Flag for 20% complete -
status40p
Flag for 40% complete -
status60p
Flag for 60% complete -
status80p
Flag for 80% complete -
status100p
Flag for 100% complete
-
-
Constructor Details
-
FloodingGenerator
public FloodingGenerator(AtlantisTerrainFactory atlantisTerrainFactory, AtlantisGameArea atlantisGameArea) Creates the entity that manages flooding for the game.- Parameters:
atlantisTerrainFactory
- Terrain factory for the game area.atlantisGameArea
- Main game area.
-
-
Method Details
-
resetFlags
public void resetFlags()Sets all completion flags to false. -
startTimer
public void startTimer()Starts the countdown for flooding to occur. -
create
public void create()Create the component in the game. -
update
public void update()To be called each time update is called. -
updateFlags
Updates the internal flag logic.- Returns:
- True if the flag changed. False otherwise.
-
setFlags
public void setFlags()Sets flags from the internal timer flags. -
dispose
public void dispose()Remove the entity from the game. -
triggerFlashTilesEvent
public void triggerFlashTilesEvent()Flashes tiles that will be flooded on the next iteration. -
triggerFloodEvent
public void triggerFloodEvent()Algorithm that determines which tiles to be flooded on the next flooding event. The call to atlantisTerrainFactory updates the structure of mapGenerator.
-