A tick accumulator.
More...
|
void | AddTicks (int ticks) |
| Adds a specified number of ticks to the TickAccumulator.
|
|
void | AddTime (double dt, double step, int? maxTicks=null) |
| Adds a specified amount of time to the TickAccumulator, incrementing the tick count as necessary.
|
|
float | Alpha (double step) |
| Calculates the alpha value based on the given step.
|
|
bool | ConsumeTick (out bool last) |
| Consumes a tick from the TickAccumulator.
|
|
void | Start () |
| Starts the TickAccumulator, allowing it to accumulate ticks.
|
|
void | Stop () |
| Stops the TickAccumulator from accumulating ticks.
|
|
|
bool | _running |
|
double | _scale |
|
int | _ticks |
|
double | _time |
|
|
int | Pending [get] |
| Gets the number of pending ticks in the TickAccumulator.
|
|
double | Remainder [get] |
| Gets the remaining time in the TickAccumulator.
|
|
bool | Running [get] |
| Gets a value indicating whether the TickAccumulator is running.
|
|
double | TimeScale [get, set] |
| Gets or sets the time scale of the TickAccumulator.
|
|
◆ AddTicks()
void AddTicks |
( |
int |
ticks | ) |
|
Adds a specified number of ticks to the TickAccumulator.
- Parameters
-
ticks | The 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
-
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. |
◆ Alpha()
float Alpha |
( |
double |
step | ) |
|
Calculates the alpha value based on the given step.
- Parameters
-
step | The 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
-
last | When 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.
◆ StartNew()
Starts a new TickAccumulator.
- Returns
- A new TickAccumulator.
◆ TimeScale
Gets or sets the time scale of the TickAccumulator.
- Exceptions
-
InvalidOperationException | Thrown when the value is less than or equal to 0. |