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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the elapsed time since game starts.booleanCheck if the elapsed time is greater than the set time.voidnotifyAllObservers(DataPackage dataPackage) Do nothing.voidStart a timer.voidSet a time limit to the game.
-
Constructor Details
-
TimedLayer
public TimedLayer()
-
-
Method Details
-
onGameStart
public void onGameStart()Start a timer.- Specified by:
onGameStartin 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:
notifyAllObserversin interfaceGameLayer- Parameters:
dataPackage- - relavent data received from game
-