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 TypeMethodDescriptionvoid
end()
End the model.boolean
Indicates 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.void
registerTestScene
(Function<GameModel, ILevelScene> constructor) Register a special testscene for debugging.void
Remove all filters.void
Set a filter.void
start()
Start the model.void
switchScene
(Function<GameModel, ILevelScene> constructor) Switch to scene with default parameters.void
Switch to scene with default parameters.void
switchScene
(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:Model
Start the model. -
end
public void end()Description copied from interface:Model
End 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 theScenes
enum.- Parameters:
s
- the scene to switch tooptions
- pass options to the scene (e.g. the arcade level id)
-
getScene
Description copied from interface:Model
Get the current scene. The scene to be drawn. -
getPlayer
Return player. -
getMenu
Description copied from interface:Model
Get the Menu.- Specified by:
getMenu
in interfaceModel
- Returns:
- the menu or
null
when not inModel.GameState.MENU
-
getState
Description copied from interface:Model
Get the current state. -
setFilter
Description copied from interface:Model
Set a filter. -
removeFilter
public void removeFilter()Description copied from interface:Model
Remove all filters.- Specified by:
removeFilter
in interfaceModel
-
filterChanged
public boolean filterChanged()Description copied from interface:Model
Indicates whether the filter has been changed.- Specified by:
filterChanged
in interfaceModel
- Returns:
true
if changed,false
otherwise
-
getFilter
Description copied from interface:Model
Get the current filter and resetModel.filterChanged()
. -
registerTestScene
Description copied from interface:Model
Register a special testscene for debugging.- Specified by:
registerTestScene
in interfaceModel
- Parameters:
constructor
- the constructor
-
getTestSceneConstructor
Description copied from interface:Model
Get the special testscene's constructor.- Specified by:
getTestSceneConstructor
in interfaceModel
- Returns:
- the constructor if set
-