Class GameTime

java.lang.Object
com.csse3200.game.services.GameTime

public class GameTime extends Object
Controls the game time
  • Constructor Details

    • GameTime

      public GameTime()
  • Method Details

    • setPaused

      public void setPaused(boolean paused)
      Sets the status of the game to be paused (true) or not (false).
      Parameters:
      paused - True if the game is currently paused, False otherwise
    • isPaused

      public boolean isPaused()
      Gets the current pause state of the game
      Returns:
      True if the game is paused, false if not
    • 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
    • getTimeSince

      public long getTimeSince(long lastTime)