Quantum 3
3.0.9
Built-in timer struct for game logic. More...
Public Member Functions | |
| readonly int | ElapsedFrames (FrameBase frame) |
| How many frames or ticks since the timer was started. More... | |
| readonly FP | ElapsedSeconds (FrameBase frame) |
| How long since the timer has started in seconds. More... | |
| readonly override int | GetHashCode () |
| Overrides the hash code generation of this type. More... | |
| readonly bool | HasStoppedThisFrame (FrameBase frame) |
| Has the timer expired during this frame. More... | |
| readonly bool | IsRunning (FrameBase frame) |
| Is the timer set and still running. More... | |
| readonly int | RemainingFrames (FrameBase frame) |
| How many frames are remaining until the timer expires. More... | |
| readonly FP | RemainingSeconds (FrameBase frame) |
| How much time is remaining until the timer expires in seconds. More... | |
| void | Restart (FrameBase frame) |
| Restarts the timer. More... | |
Static Public Member Functions | |
| static FrameTimer | FromFrames (FrameBase frame, int durationInFrames) |
| Create a new timer from a delay in frames. More... | |
| static FrameTimer | FromSeconds (FrameBase frame, FP durationInSeconds) |
| Create a new timer from a delay in seconds. More... | |
| static void | Serialize (void *ptr, IDeterministicFrameSerializer serializer) |
| Serializes a FrameTimer into a FrameSerializer to write or read from a frame snapshot. More... | |
Public Attributes | |
| readonly bool | IsSet => TargetFrame >= StartFrame && StartFrame > 0 |
| If the timer is has been set. A valid timer has a StartFrame greater than 0 and the target frame TargetFrame greater than or equal to the StartFrame. More... | |
| int | StartFrame |
| The frame number at which the timer has started. More... | |
| int | TargetFrame |
| The frame number at which the timer will run out. More... | |
Static Public Attributes | |
| static FrameTimer | None = default |
| Empty timer. More... | |
| const int | SIZE = sizeof(int) * 2 |
| The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More... | |
Built-in timer struct for game logic.
| readonly bool Quantum.FrameTimer.IsRunning | ( | FrameBase | frame | ) |
Is the timer set and still running.
| frame | The current Frame instance. |
true if the timer is valid and the current frame > number is smaller than TargetFrame. false otherwise. | readonly bool Quantum.FrameTimer.HasStoppedThisFrame | ( | FrameBase | frame | ) |
Has the timer expired during this frame.
| frame | The current Frame instance. |
true if the timer is not expired and the current frame number is equal to TargetFrame. false otherwise. Useful for one time operations that happen only at timer expiry.
|
inline |
How many frames are remaining until the timer expires.
| frame | The current Frame instance. |
How much time is remaining until the timer expires in seconds.
| frame | The current Frame instance. |
|
inline |
How many frames or ticks since the timer was started.
| frame | The current Frame instance. |
How long since the timer has started in seconds.
| frame | The current Frame instance. |
|
inline |
Restarts the timer.
| frame | The current Frame instance. |
|
inlinestatic |
Create a new timer from a delay in seconds.
| frame | |
| durationInSeconds |
|
inlinestatic |
Create a new timer from a delay in frames.
| frame | The current Frame instance. |
| durationInFrames | The number of frames to wait before the timer expires. |
|
inlinestatic |
Serializes a FrameTimer into a FrameSerializer to write or read from a frame snapshot.
| ptr | The pointer to the FrameTimer. |
| serializer | The FrameSerializer instance into which the struct will be serialized. |
|
inline |
Overrides the hash code generation of this type.
|
static |
The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.
|
static |
Empty timer.
| int Quantum.FrameTimer.TargetFrame |
The frame number at which the timer will run out.
| int Quantum.FrameTimer.StartFrame |
The frame number at which the timer has started.
| readonly bool Quantum.FrameTimer.IsSet => TargetFrame >= StartFrame && StartFrame > 0 |
If the timer is has been set. A valid timer has a StartFrame greater than 0 and the target frame TargetFrame greater than or equal to the StartFrame.