Package sac.model.gamemodes
Class ScoreSystemLayer
java.lang.Object
sac.model.gamemodes.ScoreSystemLayer
- All Implemented Interfaces:
GameLayer
Score system layer is responsible for calculating the scores.
The score calculation scheme can be changed by change the subscription of score observers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddScoreObserver
(ScoreObserver scoreObserver) Add a score observer (Add a score calculation scheme).int
getScore()
Get the score incremented during one tick.boolean
Get whether the game-over condition is met.void
notifyAllObservers
(DataPackage dataPackage) Notify all score observers to calculate score incremented.void
Define what to initialize before the game starts.
-
Constructor Details
-
ScoreSystemLayer
public ScoreSystemLayer()
-
-
Method Details
-
onGameStart
public void onGameStart()Description copied from interface:GameLayer
Define what to initialize before the game starts.- Specified by:
onGameStart
in interfaceGameLayer
-
isGameEnd
public boolean isGameEnd()Description copied from interface:GameLayer
Get whether the game-over condition is met. -
notifyAllObservers
Notify all score observers to calculate score incremented.- Specified by:
notifyAllObservers
in interfaceGameLayer
- Parameters:
dataPackage
- - relavent data received from game
-
getScore
public int getScore()Get the score incremented during one tick.- Returns:
-
addScoreObserver
Add a score observer (Add a score calculation scheme).- Parameters:
scoreObserver
-- Returns:
- this
-