Class RealTimeManager

java.lang.Object
net.thewinnt.cutscenes.time.RealTimeManager
All Implemented Interfaces:
TimeManager

public class RealTimeManager extends Object implements TimeManager
Creates a constant, realtime-based time manager, running steadily at 1 TPS.
  • Field Summary

    Fields inherited from interface net.thewinnt.cutscenes.time.TimeManager

    DEFAULT_TRANSITIONS, REGISTRY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    If this returns true, it means that cutscene length is synchronized with the server tickrate and can, therefore, be defined in ticks
    void
    setGameTickRate(float tickrate)
    Notifies the time manager that the game tick rate has changed.
    void
    Starts the timer from zero.
    void
    syncGameTime(long gameTime)
    Notifies the time manager that the game time has been synchronized.
    double
    Updates the internal state and returns the current time.
    double
    Returns the amount of 1/20ths of a second (one game tick) in one unit under typical circumstances (e.g. 20 TPS).
    Returns the type of this manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RealTimeManager

      public RealTimeManager()
  • Method Details

    • tick

      public double tick()
      Description copied from interface: TimeManager
      Updates the internal state and returns the current time.
      Specified by:
      tick in interface TimeManager
      Returns:
      a value representing the current time since a cutscene started, in time units.
    • start

      public void start()
      Description copied from interface: TimeManager
      Starts the timer from zero. The next call to TimeManager.tick() is not guaranteed to return exactly zero after this.
      Specified by:
      start in interface TimeManager
    • setGameTickRate

      public void setGameTickRate(float tickrate)
      Description copied from interface: TimeManager
      Notifies the time manager that the game tick rate has changed.
      Specified by:
      setGameTickRate in interface TimeManager
      Parameters:
      tickrate - the new tickrate, in game ticks per second.
    • syncGameTime

      public void syncGameTime(long gameTime)
      Description copied from interface: TimeManager
      Notifies the time manager that the game time has been synchronized.
      Specified by:
      syncGameTime in interface TimeManager
      Parameters:
      gameTime - the current game time
    • isServerSynched

      public boolean isServerSynched()
      Description copied from interface: TimeManager
      If this returns true, it means that cutscene length is synchronized with the server tickrate and can, therefore, be defined in ticks
      Specified by:
      isServerSynched in interface TimeManager
      Returns:
      whether the length of the cutscene is related to server tickrate
    • type

      public String type()
      Description copied from interface: TimeManager
      Returns the type of this manager. Must be one of the entries in TimeManager.REGISTRY.
      Specified by:
      type in interface TimeManager
      Returns:
      the type of this time manager
    • ticksPerUnit

      public double ticksPerUnit()
      Description copied from interface: TimeManager
      Returns the amount of 1/20ths of a second (one game tick) in one unit under typical circumstances (e.g. 20 TPS).
      Specified by:
      ticksPerUnit in interface TimeManager
      Returns:
      (unit length in seconds) * 20