Package sac.model.gamemodes
Class TimedLayer
java.lang.Object
sac.model.gamemodes.TimedLayer
- All Implemented Interfaces:
GameLayer
Timed the game.
End the game when the elapsed time is greater than the set value.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the elapsed time since game starts.boolean
Check if the elapsed time is greater than the set time.void
notifyAllObservers
(DataPackage dataPackage) Do nothing.void
Start a timer.void
Set a time limit to the game.
-
Constructor Details
-
TimedLayer
public TimedLayer()
-
-
Method Details
-
onGameStart
public void onGameStart()Start a timer.- Specified by:
onGameStart
in interfaceGameLayer
-
isGameEnd
public boolean isGameEnd()Check if the elapsed time is greater than the set time. -
setTimer
Set a time limit to the game.- Parameters:
timer
- - the time limit in the form of "mm:ss"
-
getCurrentTime
Get the elapsed time since game starts.- Returns:
- the elapsed time in the form of "mm:ss"
-
notifyAllObservers
Do nothing. Unrelated to this game layer.- Specified by:
notifyAllObservers
in interfaceGameLayer
- Parameters:
dataPackage
- - relavent data received from game
-