Package rekit.logic

Interface IScene

All Known Subinterfaces:
ILevelScene
All Known Implementing Classes:
LevelScene

public interface IScene
This is the public interface of all Scenes.
Author:
Dominik Fuchss
  • Method Details

    • addGameElement

      void addGameElement(GameElement e)
      Adds a GameElement to the Model. The elements will not directly be added to the internal data structure to prevent concurrency errors. Instead there is an internal list to hold all waiting GameElements that will be added in the next call of logicLoop
      Parameters:
      e - the GameElement to add
    • markForRemove

      void markForRemove(GameElement e)
      Removes a GameElement from the Model The elements will not directly be removed from the internal data structure to prevent concurrency errors. Instead there is an internal list to hold all waiting GameElements that will be removed in the next call of logicLoop
      Parameters:
      e - the GameElement to remove
    • addGuiElement

      void addGuiElement(GuiElement e)
      Adds a GuiElement to the GameModel.
      Parameters:
      e - the GuiElement to add
    • removeGuiElement

      void removeGuiElement(GuiElement e)
      Removes a GuiElement to the GameModel.
      Parameters:
      e - the GuiElement to remove
    • setCameraTarget

      void setCameraTarget(CameraTarget cameraTarget)
      Set the camera target.
      Parameters:
      cameraTarget - the camera target
    • getCameraOffset

      float getCameraOffset()
      Get the current camera offset.
      Returns:
      the current camera offset
    • applyToNonNeutralGameElements

      void applyToNonNeutralGameElements(Consumer<GameElement> function)
      Apply function on game elements (non-neutral).
      Parameters:
      function - the function
      See Also:
    • applyToGameElements

      void applyToGameElements(Consumer<GameElement> function)
      Apply function on all game elements.
      Parameters:
      function - the function
    • applyToGuiElements

      void applyToGuiElements(Consumer<GuiElement> function)
      Apply function on game elements.
      Parameters:
      function - the function
    • getModel

      Model getModel()
      Get the model of the MVC.
      Returns:
      the model
    • logicLoop

      void logicLoop()
      Invoke logic.
    • init

      void init()
      Initialize the scene. e.g. build Level/GUI so Scene is ready to be drawn Must be called on restart.
    • start

      default void start()
      Start the scene. Begin drawing and Player/Enemies will begin to move.
    • restart

      default void restart()
      Restart the scene.
    • getGameElementDurations

      Map<String,Long> getGameElementDurations()
      Get a map of duration-time of elements.
      Returns:
      the duration-time of elements by class
    • getGameElementCount

      int getGameElementCount()
      Get the amount of elements in the scene.
      Returns:
      the amount of elements
    • getMenu

      MenuItem getMenu()
      Get the associated Root-MenuItem.
      Returns:
      the root-menuItem or null if no Scenes.MAIN_MENU
    • togglePause

      boolean togglePause()
      Toggle pause for the scene. See setPause(boolean).
      Returns:
      true iff operation is possible, false otherwise
    • setCanPause

      void setCanPause(boolean canPause)
      Set whether the game can paused
      Parameters:
      canPause - true iff pausable
    • isPaused

      boolean isPaused()
      Indicates whether the scene is paused.
      Returns:
      true if paused, false otherwise
    • setPause

      void setPause(boolean pause)
      Set the pause state. When pause usually the logic loop Useful when resetting.
      Parameters:
      pause - the new pause state
    • isLevelScene

      default boolean isLevelScene()
      This method indicates whether the scene encapsulates a level.
      Returns:
      true if this scene encapsulates a level, false otherwise
    • attack

      default void attack(boolean active)
      Will invoked if user wants to attack something.
      Parameters:
      active - indicates whether attack is active or not (this means that the Attack-Key is pressed or not)
      See Also:
    • setAttackHandler

      default void setAttackHandler(Consumer<Boolean> handler)
      The handler of attack(boolean).
      Parameters:
      handler - the handler or null to reset
      See Also: