Table of Contents

Class LocalWorldClock

Namespace
FishMMO.Shared.Celestial
Assembly
FishMMO.Shared.dll

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

tickRate double
startWorldSeconds double

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

LocalWorldClock

Held

public bool Held { get; }

Property Value

bool

Rate

World seconds per real second now: 0 held, 1 the world's own pace.

public double Rate { get; }

Property Value

double

Tick

The current (fractional) tick, counted from when the clock was made.

public double Tick { get; }

Property Value

double

TickDelta

public double TickDelta { get; }

Property Value

double

TickRate

Ticks a real second. Fixed, as the server's is.

public double TickRate { get; }

Property Value

double

WorldSeconds

World seconds since the epoch now.

public double WorldSeconds { get; }

Property Value

double

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

clock LocalWorldClock

Advance(double)

Counts the tick on by a stretch of real time. Call once a frame.

public void Advance(double realSeconds)

Parameters

realSeconds double

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

rate double

SetWorldSeconds(double)

Sets the world time outright, to the millisecond, keeping the pace.

public void SetWorldSeconds(double worldSeconds)

Parameters

worldSeconds double

Step(double)

Moves the world on (or back) by world seconds, held or running.

public void Step(double worldSeconds)

Parameters

worldSeconds double