Package rekit.logic
Class GameModel
java.lang.Object
rekit.logic.GameModel
- All Implemented Interfaces:
Model
Main class of the Model. Manages the logic.
- Author:
- Angelo Aracri, Dominik Fuchss
-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Model
Model.GameState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidend()End the model.booleanIndicates whether the filter has been changed.Get the current filter and resetModel.filterChanged().getMenu()Get the Menu.Return player.getScene()Get the current scene.getState()Get the current state.Get the special testscene's constructor.voidregisterTestScene(Function<GameModel, ILevelScene> constructor) Register a special testscene for debugging.voidRemove all filters.voidSet a filter.voidstart()Start the model.voidswitchScene(Function<GameModel, ILevelScene> constructor) Switch to scene with default parameters.voidSwitch to scene with default parameters.voidswitchScene(Scenes s, String... options) Switch to a differentScenes.# The new Scene will be initialized an started immediately.
-
Constructor Details
-
GameModel
public GameModel()Get a new model.
-
-
Method Details
-
start
public void start()Description copied from interface:ModelStart the model. -
end
public void end()Description copied from interface:ModelEnd the model. -
switchScene
Switch to scene with default parameters.- Parameters:
s- the new scene.
-
switchScene
Switch to scene with default parameters.- Parameters:
constructor- the new scene's constructor.
-
switchScene
Switch to a differentScenes.# The new Scene will be initialized an started immediately.
Before you can switch to a newly created Scene you must create an entry in theScenesenum.- Parameters:
s- the scene to switch tooptions- pass options to the scene (e.g. the arcade level id)
-
getScene
Description copied from interface:ModelGet the current scene. The scene to be drawn. -
getPlayer
Return player. -
getMenu
Description copied from interface:ModelGet the Menu.- Specified by:
getMenuin interfaceModel- Returns:
- the menu or
nullwhen not inModel.GameState.MENU
-
getState
Description copied from interface:ModelGet the current state. -
setFilter
Description copied from interface:ModelSet a filter. -
removeFilter
public void removeFilter()Description copied from interface:ModelRemove all filters.- Specified by:
removeFilterin interfaceModel
-
filterChanged
public boolean filterChanged()Description copied from interface:ModelIndicates whether the filter has been changed.- Specified by:
filterChangedin interfaceModel- Returns:
trueif changed,falseotherwise
-
getFilter
Description copied from interface:ModelGet the current filter and resetModel.filterChanged(). -
registerTestScene
Description copied from interface:ModelRegister a special testscene for debugging.- Specified by:
registerTestScenein interfaceModel- Parameters:
constructor- the constructor
-
getTestSceneConstructor
Description copied from interface:ModelGet the special testscene's constructor.- Specified by:
getTestSceneConstructorin interfaceModel- Returns:
- the constructor if set
-