Class LocalWorldClock
The world's tick when there is no server: a stand-in for FishNet's synchronised tick that the World Sim bed (or any offline tool) runs, and drives the shared WorldClock exactly as a scene server does — so everything in the editor reads time down the same path as the game.
public sealed class LocalWorldClock
- Inheritance
-
LocalWorldClock
- Inherited Members
Remarks
The tick never changes pace. It counts at TickRate a real second, paused or not, as FishNet's does. Setting the time, holding it or racing it publishes a new anchor at the current tick (Override(uint, double, double, bool)) — the same thing an admin's command does on a live server — so the editor exercises the game's own behaviour, not a copy of it.
While one is Active, CurrentHours(TimeManager) reads it in place of a TimeManager, and WorldMotion follows its pace.
Constructors
LocalWorldClock(double, double)
public LocalWorldClock(double tickRate = 30, double startWorldSeconds = 0)
Parameters
Properties
Active
The clock in use offline, or null (a live game, where FishNet's tick is used).
public static LocalWorldClock Active { get; }
Property Value
Held
public bool Held { get; }
Property Value
Rate
World seconds per real second now: 0 held, 1 the world's own pace.
public double Rate { get; }
Property Value
Tick
The current (fractional) tick, counted from when the clock was made.
public double Tick { get; }
Property Value
TickDelta
public double TickDelta { get; }
Property Value
TickRate
Ticks a real second. Fixed, as the server's is.
public double TickRate { get; }
Property Value
WorldSeconds
World seconds since the epoch now.
public double WorldSeconds { get; }
Property Value
Methods
Activate(LocalWorldClock)
Makes this the clock offline time reads; null stops offline time (and forgets the anchor).
public static void Activate(LocalWorldClock clock)
Parameters
clockLocalWorldClock
Advance(double)
Counts the tick on by a stretch of real time. Call once a frame.
public void Advance(double realSeconds)
Parameters
realSecondsdouble
Hold()
Holds the world where it is; the tick goes on counting.
public void Hold()
Resume()
Runs the world again at the pace it was held from.
public void Resume()
SetRate(double)
Sets the pace (0 holds), from the moment the clock reads now.
public void SetRate(double rate)
Parameters
ratedouble
SetWorldSeconds(double)
Sets the world time outright, to the millisecond, keeping the pace.
public void SetWorldSeconds(double worldSeconds)
Parameters
worldSecondsdouble
Step(double)
Moves the world on (or back) by world seconds, held or running.
public void Step(double worldSeconds)
Parameters
worldSecondsdouble