Package net.thewinnt.cutscenes.time
Class RealTimeManager
java.lang.Object
net.thewinnt.cutscenes.time.RealTimeManager
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanIf this returnstrue, it means that cutscene length is synchronized with the server tickrate and can, therefore, be defined in ticksvoidsetGameTickRate(float tickrate) Notifies the time manager that the game tick rate has changed.voidstart()Starts the timer from zero.voidsyncGameTime(long gameTime) Notifies the time manager that the game time has been synchronized.doubletick()Updates the internal state and returns the current time.doubleReturns the amount of 1/20ths of a second (one game tick) in one unit under typical circumstances (e.g. 20 TPS).type()Returns the type of this manager.
-
Constructor Details
-
RealTimeManager
public RealTimeManager()
-
-
Method Details
-
tick
public double tick()Description copied from interface:TimeManagerUpdates the internal state and returns the current time.- Specified by:
tickin interfaceTimeManager- Returns:
- a value representing the current time since a cutscene started, in time units.
-
start
public void start()Description copied from interface:TimeManagerStarts the timer from zero. The next call toTimeManager.tick()is not guaranteed to return exactly zero after this.- Specified by:
startin interfaceTimeManager
-
setGameTickRate
public void setGameTickRate(float tickrate) Description copied from interface:TimeManagerNotifies the time manager that the game tick rate has changed.- Specified by:
setGameTickRatein interfaceTimeManager- Parameters:
tickrate- the new tickrate, in game ticks per second.
-
syncGameTime
public void syncGameTime(long gameTime) Description copied from interface:TimeManagerNotifies the time manager that the game time has been synchronized.- Specified by:
syncGameTimein interfaceTimeManager- Parameters:
gameTime- the current game time
-
isServerSynched
public boolean isServerSynched()Description copied from interface:TimeManagerIf this returnstrue, it means that cutscene length is synchronized with the server tickrate and can, therefore, be defined in ticks- Specified by:
isServerSynchedin interfaceTimeManager- Returns:
- whether the length of the cutscene is related to server tickrate
-
type
Description copied from interface:TimeManagerReturns the type of this manager. Must be one of the entries inTimeManager.REGISTRY.- Specified by:
typein interfaceTimeManager- Returns:
- the type of this time manager
-
ticksPerUnit
public double ticksPerUnit()Description copied from interface:TimeManagerReturns the amount of 1/20ths of a second (one game tick) in one unit under typical circumstances (e.g. 20 TPS).- Specified by:
ticksPerUnitin interfaceTimeManager- Returns:
- (unit length in seconds) * 20
-