Class FloodingGenerator

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.areas.MapGenerator.FloodingGenerator

public class FloodingGenerator extends Component
  • Field Details

    • timer

      public Timer timer
      Flooding timer to signal flooding event.
    • status20p

      public Boolean status20p
      Flag for 20% complete
    • status40p

      public Boolean status40p
      Flag for 40% complete
    • status60p

      public Boolean status60p
      Flag for 60% complete
    • status80p

      public Boolean status80p
      Flag for 80% complete
    • status100p

      public Boolean 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.
      Overrides:
      create in class Component
    • update

      public void update()
      To be called each time update is called.
      Overrides:
      update in class Component
    • updateFlags

      public Boolean 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.
      Overrides:
      dispose in class Component
    • 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.