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... | |
A tick accumulator.
void AddTicks | ( | int | ticks | ) |
Adds a specified number of ticks to the TickAccumulator.
ticks | The number of ticks to add. |
void AddTime | ( | double | dt, |
double | step, | ||
int? | maxTicks = null |
||
) |
Adds a specified amount of time to the TickAccumulator, incrementing the tick count as necessary.
dt | The amount of time to add. |
step | The time step value. |
maxTicks | The maximum number of ticks to add. If this value is reached, the remaining time is set to 0. |
float Alpha | ( | double | step | ) |
Calculates the alpha value based on the given step.
step | The step value used to calculate the alpha. |
bool ConsumeTick | ( | out bool | last | ) |
Consumes a tick from the TickAccumulator.
last | When this method returns, contains a boolean indicating whether the consumed tick was the last one. |
void Start | ( | ) |
Starts the TickAccumulator, allowing it to accumulate ticks.
|
static |
Starts a new TickAccumulator.
void Stop | ( | ) |
Stops the TickAccumulator from accumulating ticks.
|
get |
Gets the number of pending ticks in the TickAccumulator.
|
get |
Gets the remaining time in the TickAccumulator.
|
get |
Gets a value indicating whether the TickAccumulator is running.
|
getset |
Gets or sets the time scale of the TickAccumulator.
InvalidOperationException | Thrown when the value is less than or equal to 0. |