Built in timer used for timing game logic. More...
Public Member Functions | |
override int | GetHashCode () |
Overrides the hash code generation of this type. More... | |
bool | IsExpired (FrameBase frame) |
If the timer is valid and has expired. More... | |
bool | IsExpiredOrNotValid (FrameBase frame) |
If the timer is not valid or has expired. More... | |
bool | IsExpiredThisFrame (FrameBase frame) |
If the timer expired during this frame. More... | |
bool | IsRunning (FrameBase frame) |
If the timer is not expired. More... | |
int? | RemainingFrames (FrameBase frame) |
How many frames are remaining until the timer expires. More... | |
FP? | RemainingTime (FrameBase frame) |
How much time is remaining until the timer expires. More... | |
void | Restart (FrameBase frame) |
Restarts the timer. More... | |
int? | TimeInFramesSinceStart (FrameBase frame) |
How long since the timer has started in frames. More... | |
FP? | TimeInSecondsSinceStart (FrameBase frame) |
How long since the timer has started in seconds. More... | |
Static Public Member Functions | |
static FrameTimer | FromFrames (FrameBase frame, int frames) |
Create a new timer from a delay in frames. More... | |
static FrameTimer | FromSeconds (FrameBase frame, FP delayInSeconds) |
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 | |
bool | IsValid => Value >= StartFrame && StartFrame > 0 |
If the timer is valid. A valid timer has a StartFrame greater than 0 and the target frame Value greater than or equal to the StartFrame. More... | |
int | StartFrame |
The frame number at which the timer has started. More... | |
int? | TargetFrame => IsValid ? Value : default |
The target frame of the timer, if the timer is valid. More... | |
int | Value |
The frame number at which the timer will expire. 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 used for timing game logic.
bool Quantum.FrameTimer.IsExpired | ( | FrameBase | frame | ) |
bool Quantum.FrameTimer.IsExpiredThisFrame | ( | FrameBase | frame | ) |
bool Quantum.FrameTimer.IsRunning | ( | FrameBase | frame | ) |
If the timer is not expired.
frame | The current Frame instance. |
true
if the timer is not expired. false
otherwise. bool Quantum.FrameTimer.IsExpiredOrNotValid | ( | FrameBase | frame | ) |
|
inline |
How many frames are remaining until the timer expires.
frame | The current Frame instance. |
null
. How much time is remaining until the timer expires.
frame | The current Frame instance. |
null
.
|
inline |
How long since the timer has started in frames.
frame | The current Frame instance. |
null
. How long since the timer has started in seconds.
frame | The current Frame instance. |
null
.
|
inline |
Restarts the timer.
frame | The current Frame instance. |
|
inlinestatic |
Create a new timer from a delay in seconds.
frame | |
delayInSeconds |
|
inlinestatic |
Create a new timer from a delay in frames.
frame | The current Frame instance. |
frames | 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.Value |
The frame number at which the timer will expire.
int Quantum.FrameTimer.StartFrame |
The frame number at which the timer has started.
bool Quantum.FrameTimer.IsValid => Value >= StartFrame && StartFrame > 0 |
If the timer is valid. A valid timer has a StartFrame greater than 0 and the target frame Value greater than or equal to the StartFrame.