ScoreObserverComponent Class
Component that observes and caches the score value from a ScorePool. More...
Declaration
Friends Index
| class | helios::engine::mechanics::scoring::systems::ScoreObserverClearSystem |
Public Constructors Index
| ScoreObserverComponent ()=default | |
| ScoreObserverComponent (const ScoreObserverComponent &other) | |
|
Copy constructor. More... | |
| ScoreObserverComponent (ScoreObserverComponent &&) noexcept=default | |
Public Operators Index
| ScoreObserverComponent & | operator= (const ScoreObserverComponent &)=default |
| ScoreObserverComponent & | operator= (ScoreObserverComponent &&) noexcept=default |
Public Member Functions Index
| bool | isEnabled () const noexcept |
|
Checks whether this component is enabled. More... | |
| void | enable () noexcept |
|
Enables this component. More... | |
| void | disable () noexcept |
|
Disables this component. More... | |
| void | setScorePoolId (const helios::engine::mechanics::scoring::types::ScorePoolId scorePoolId) noexcept |
|
Sets the score pool to observe. More... | |
| helios::engine::mechanics::scoring::types::ScorePoolId | scorePoolId () const noexcept |
|
Returns the observed score pool ID. More... | |
| void | setScorePoolSnapshot (const helios::engine::mechanics::scoring::ScorePoolSnapshot &snapshot) noexcept |
|
Sets the cached snapshot value. More... | |
| ScorePoolRevision | scorePoolRevision () const noexcept |
|
Returns the cached score pool revision. More... | |
| double | totalScore () const noexcept |
|
Returns the cached total score. More... | |
| bool | hasUpdate () const noexcept |
|
Checks if the value changed since last clear. More... | |
| void | onAcquire () noexcept |
|
Called when this entity is acquired from a pool. More... | |
| void | onRelease () noexcept |
|
Called when this entity is released back to a pool. More... | |
Private Member Functions Index
| void | clearUpdate () |
|
Clears the update flag. More... | |
Private Member Attributes Index
| helios::engine::mechanics::scoring::types::ScorePoolId | scorePoolId_ {helios::core::types::no_init} |
|
ID of the score pool to observe. More... | |
| bool | hasUpdate_ = true |
|
Flag indicating whether the value changed this frame. More... | |
| helios::engine::mechanics::scoring::ScorePoolSnapshot | snapshot_ |
|
the current snapshot saved by this observer component. More... | |
| bool | isEnabled_ = true |
|
Whether this component is enabled. More... | |
Description
Component that observes and caches the score value from a ScorePool.
Attached to UI entities to display score values. The ScoreObserverUpdateSystem updates this component's snapshot from the referenced ScorePool each frame. The hasUpdate flag indicates when the value has changed.
- See Also
ScoreObserverUpdateSystem
- See Also
- See Also
Definition at line 35 of file ScoreObserverComponent.ixx.
Friends
helios::engine::mechanics::scoring::systems::ScoreObserverClearSystem
Definition at line 37 of file ScoreObserverComponent.ixx.
Reference helios::core::types::no_init.
Public Constructors
ScoreObserverComponent()
| default |
Definition at line 98 of file ScoreObserverComponent.ixx.
Referenced by operator=, operator=, ScoreObserverComponent and ScoreObserverComponent.
ScoreObserverComponent()
| inline |
Copy constructor.
- Parameters
-
other The component to copy from.
Definition at line 105 of file ScoreObserverComponent.ixx.
Reference ScoreObserverComponent.
ScoreObserverComponent()
| noexcept default |
Definition at line 109 of file ScoreObserverComponent.ixx.
Reference ScoreObserverComponent.
Public Operators
operator=()
| default |
Definition at line 108 of file ScoreObserverComponent.ixx.
Reference ScoreObserverComponent.
operator=()
| noexcept default |
Definition at line 110 of file ScoreObserverComponent.ixx.
Reference ScoreObserverComponent.
Public Member Functions
disable()
| inline noexcept |
Disables this component.
Definition at line 94 of file ScoreObserverComponent.ixx.
enable()
| inline noexcept |
Enables this component.
Definition at line 87 of file ScoreObserverComponent.ixx.
hasUpdate()
| inline nodiscard noexcept |
Checks if the value changed since last clear.
- Returns
True if the value was updated this frame.
Definition at line 168 of file ScoreObserverComponent.ixx.
isEnabled()
| inline nodiscard noexcept |
Checks whether this component is enabled.
- Returns
True if enabled, false otherwise.
Definition at line 80 of file ScoreObserverComponent.ixx.
onAcquire()
| inline noexcept |
Called when this entity is acquired from a pool.
Clears the update flag and resets the cached snapshot.
Definition at line 177 of file ScoreObserverComponent.ixx.
onRelease()
| inline noexcept |
Called when this entity is released back to a pool.
Clears the update flag and resets the cached snapshot.
Definition at line 187 of file ScoreObserverComponent.ixx.
scorePoolId()
| inline nodiscard noexcept |
Returns the observed score pool ID.
- Returns
The ScorePoolId.
Definition at line 126 of file ScoreObserverComponent.ixx.
Referenced by setScorePoolId.
scorePoolRevision()
| inline nodiscard noexcept |
Returns the cached score pool revision.
- Returns
The revision of the last observed snapshot.
Definition at line 150 of file ScoreObserverComponent.ixx.
setScorePoolId()
| inline noexcept |
Sets the score pool to observe.
- Parameters
-
scorePoolId The ID of the pool to observe.
Definition at line 117 of file ScoreObserverComponent.ixx.
References scorePoolId and setScorePoolId.
Referenced by setScorePoolId.
setScorePoolSnapshot()
| inline noexcept |
Sets the cached snapshot value.
Sets hasUpdate to true if the value changes.
- Parameters
-
snapshot The snapshot to use for the next update.
Definition at line 137 of file ScoreObserverComponent.ixx.
totalScore()
| inline nodiscard noexcept |
Returns the cached total score.
- Returns
The current score value.
Definition at line 159 of file ScoreObserverComponent.ixx.
Private Member Functions
clearUpdate()
| inline |
Clears the update flag.
Called by ScoreObserverClearSystem.
Definition at line 69 of file ScoreObserverComponent.ixx.
Private Member Attributes
hasUpdate_
|
Flag indicating whether the value changed this frame.
Cleared by ScoreObserverClearSystem at frame end.
Definition at line 52 of file ScoreObserverComponent.ixx.
isEnabled_
|
Whether this component is enabled.
Definition at line 62 of file ScoreObserverComponent.ixx.
scorePoolId_
|
ID of the score pool to observe.
Definition at line 44 of file ScoreObserverComponent.ixx.
snapshot_
|
the current snapshot saved by this observer component.
Definition at line 57 of file ScoreObserverComponent.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.