Package rekit.logic

Class GameModel

java.lang.Object
rekit.logic.GameModel
All Implemented Interfaces:
Model

public class GameModel extends Object implements Model
Main class of the Model. Manages the logic.
Author:
Angelo Aracri, Dominik Fuchss
  • Constructor Details

    • GameModel

      public GameModel()
      Get a new model.
  • Method Details

    • start

      public void start()
      Description copied from interface: Model
      Start the model.
      Specified by:
      start in interface Model
    • end

      public void end()
      Description copied from interface: Model
      End the model.
      Specified by:
      end in interface Model
    • switchScene

      public void switchScene(Scenes s)
      Switch to scene with default parameters.
      Parameters:
      s - the new scene.
    • switchScene

      public void switchScene(Function<GameModel,ILevelScene> constructor)
      Switch to scene with default parameters.
      Parameters:
      constructor - the new scene's constructor.
    • switchScene

      public void switchScene(Scenes s, String... options)
      Switch to a different Scenes.# The new Scene will be initialized an started immediately.
      Before you can switch to a newly created Scene you must create an entry in the Scenes enum.
      Parameters:
      s - the scene to switch to
      options - pass options to the scene (e.g. the arcade level id)
    • getScene

      public IScene getScene()
      Description copied from interface: Model
      Get the current scene. The scene to be drawn.
      Specified by:
      getScene in interface Model
      Returns:
      the currently active scene
    • getPlayer

      public Player getPlayer()
      Return player.
      Specified by:
      getPlayer in interface Model
      Returns:
      the player
    • getMenu

      public MenuItem getMenu()
      Description copied from interface: Model
      Get the Menu.
      Specified by:
      getMenu in interface Model
      Returns:
      the menu or null when not in Model.GameState.MENU
    • getState

      public Model.GameState getState()
      Description copied from interface: Model
      Get the current state.
      Specified by:
      getState in interface Model
      Returns:
      the state
    • setFilter

      public void setFilter(Filter f)
      Description copied from interface: Model
      Set a filter.
      Specified by:
      setFilter in interface Model
      Parameters:
      f - the filter
    • removeFilter

      public void removeFilter()
      Description copied from interface: Model
      Remove all filters.
      Specified by:
      removeFilter in interface Model
    • filterChanged

      public boolean filterChanged()
      Description copied from interface: Model
      Indicates whether the filter has been changed.
      Specified by:
      filterChanged in interface Model
      Returns:
      true if changed, false otherwise
    • getFilter

      public Filter getFilter()
      Description copied from interface: Model
      Get the current filter and reset Model.filterChanged().
      Specified by:
      getFilter in interface Model
      Returns:
      the filter or null if none set
    • registerTestScene

      public void registerTestScene(Function<GameModel,ILevelScene> constructor)
      Description copied from interface: Model
      Register a special testscene for debugging.
      Specified by:
      registerTestScene in interface Model
      Parameters:
      constructor - the constructor
    • getTestSceneConstructor

      public Function<GameModel,ILevelScene> getTestSceneConstructor()
      Description copied from interface: Model
      Get the special testscene's constructor.
      Specified by:
      getTestSceneConstructor in interface Model
      Returns:
      the constructor if set