Package com.deco2800.game.services
Class GameTime
java.lang.Object
com.deco2800.game.services.GameTime
Controls the game time
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatlongfloatlonggetTime()longgetTimeSince(long lastTime) static booleanifPaused()voidpaused()Pauses the gamevoidsetTimeScale(float timeScale) Set the speed of time passing.voidunpaused()Unpauses the game
-
Constructor Details
-
GameTime
public GameTime()
-
-
Method Details
-
setTimeScale
public void setTimeScale(float timeScale) Set the speed of time passing. This affects getDeltaTime()- Parameters:
timeScale- Time scale, where normal speed is 1.0, no time passing is 0.0
-
getDeltaTime
public float getDeltaTime()- Returns:
- time passed since the last frame in seconds, scaled by time scale.
-
getRawDeltaTime
public float getRawDeltaTime()- Returns:
- time passed since the last frame in seconds, not affected by time scale.
-
getTime
public long getTime()- Returns:
- time passed since the game started in milliseconds
-
getGameTime
public long getGameTime() -
getTimeSince
public long getTimeSince(long lastTime) -
ifPaused
public static boolean ifPaused()- Returns:
- whether the game is paused
-
paused
public void paused()Pauses the game -
unpaused
public void unpaused()Unpauses the game
-