Photon Fusion 2.0.3

Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
TickAccumulator Struct Reference

A tick accumulator. More...

Public Member Functions

void AddTicks (int ticks)
 Adds a specified number of ticks to the TickAccumulator. More...
 
void AddTime (double dt, double step, int? maxTicks=null)
 Adds a specified amount of time to the TickAccumulator, incrementing the tick count as necessary. More...
 
float Alpha (double step)
 Calculates the alpha value based on the given step. More...
 
bool ConsumeTick (out bool last)
 Consumes a tick from the TickAccumulator. More...
 
void Start ()
 Starts the TickAccumulator, allowing it to accumulate ticks. More...
 
void Stop ()
 Stops the TickAccumulator from accumulating ticks. More...
 

Static Public Member Functions

static TickAccumulator StartNew ()
 Starts a new TickAccumulator. More...
 

Public Attributes

bool _running
 
double _scale
 
int _ticks
 
double _time
 

Properties

int Pending [get]
 Gets the number of pending ticks in the TickAccumulator. More...
 
double Remainder [get]
 Gets the remaining time in the TickAccumulator. More...
 
bool Running [get]
 Gets a value indicating whether the TickAccumulator is running. More...
 
double TimeScale [get, set]
 Gets or sets the time scale of the TickAccumulator. More...
 

Detailed Description

A tick accumulator.

Member Function Documentation

◆ AddTicks()

void AddTicks ( int  ticks)

Adds a specified number of ticks to the TickAccumulator.

Parameters
ticksThe number of ticks to add.

◆ AddTime()

void AddTime ( double  dt,
double  step,
int?  maxTicks = null 
)

Adds a specified amount of time to the TickAccumulator, incrementing the tick count as necessary.

Parameters
dtThe amount of time to add.
stepThe time step value.
maxTicksThe maximum number of ticks to add. If this value is reached, the remaining time is set to 0.

◆ Alpha()

float Alpha ( double  step)

Calculates the alpha value based on the given step.

Parameters
stepThe step value used to calculate the alpha.
Returns
The calculated alpha value.

◆ ConsumeTick()

bool ConsumeTick ( out bool  last)

Consumes a tick from the TickAccumulator.

Parameters
lastWhen this method returns, contains a boolean indicating whether the consumed tick was the last one.
Returns
true if a tick was successfully consumed; otherwise, false.

◆ Start()

void Start ( )

Starts the TickAccumulator, allowing it to accumulate ticks.

◆ StartNew()

static TickAccumulator StartNew ( )
static

Starts a new TickAccumulator.

Returns
A new TickAccumulator.

◆ Stop()

void Stop ( )

Stops the TickAccumulator from accumulating ticks.

Property Documentation

◆ Pending

int Pending
get

Gets the number of pending ticks in the TickAccumulator.

◆ Remainder

double Remainder
get

Gets the remaining time in the TickAccumulator.

◆ Running

bool Running
get

Gets a value indicating whether the TickAccumulator is running.

◆ TimeScale

double TimeScale
getset

Gets or sets the time scale of the TickAccumulator.

Exceptions
InvalidOperationExceptionThrown when the value is less than or equal to 0.