Interface ITickClock

Namespace
Unity.Multiplayer.Core

The fixed-rate clock the server simulation steps on. The NGO adapter implements it off NetworkTickSystem (NetworkTickClock); ManualTickClock implements it for tests and engine-free simulations.

public interface ITickClock

Remarks

Contract every implementation keeps:

  • TickRate is at least 1 and does not change while the clock runs.
  • CurrentTick starts at 0 and goes up by exactly 1 per tick; it never skips or goes back.
  • Ticked is raised once per tick, in order, after CurrentTick holds the new tick. When a frame covers several ticks, it is raised once for each of them.
  • Time equals CurrentTick × TickInterval.

Properties

CurrentTick

Ticks elapsed since the clock started; 0 before the first tick.

long CurrentTick { get; }

Property Value

long

TickInterval

Seconds per tick: 1 / TickRate.

double TickInterval { get; }

Property Value

double

TickRate

Ticks per second.

int TickRate { get; }

Property Value

int

Time

Simulation time in seconds: CurrentTick × TickInterval.

double Time { get; }

Property Value

double

Events

Ticked

Raised once per tick with the new CurrentTick.

event Action<long> Ticked

Event Type

Action<long>