Skip to main content

ScoreObserverSystem Class

System that propagates score snapshots to ScoreObserverComponents. More...

Declaration

class helios::engine::mechanics::scoring::systems::ScoreObserverSystem { ... }

Public Member Typedefs Index

usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors Index

ScoreObserverSystem (ScorePoolManager &scorePoolManager)

Constructs the system with a reference to the ScorePoolManager. More...

Public Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept

Updates all active ScoreObserverComponents with current score data. More...

Private Member Attributes Index

ScorePoolManager &scorePoolManager_

Reference to the ScorePoolManager that owns the score pools. More...

Description

System that propagates score snapshots to ScoreObserverComponents.

Each frame, queries all active entities with a ScoreObserverComponent and updates them with the current ScorePoolSnapshot from the ScorePoolManager. The component's revision-based change detection ensures that downstream consumers (e.g. UI bindings) are only notified when the score actually changes.

See Also

ScoreObserverClearSystem

See Also

ScoreObserverComponent

See Also

ScorePoolManager

Definition at line 47 of file ScoreObserverSystem.ixx.

Public Member Typedefs

EngineRoleTag

using helios::engine::mechanics::scoring::systems::ScoreObserverSystem::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors

ScoreObserverSystem()

helios::engine::mechanics::scoring::systems::ScoreObserverSystem::ScoreObserverSystem (ScorePoolManager & scorePoolManager)
inline explicit

Constructs the system with a reference to the ScorePoolManager.

Parameters
scorePoolManager

The ScorePoolManager providing score pool state.

Definition at line 63 of file ScoreObserverSystem.ixx.

63 explicit ScoreObserverSystem(ScorePoolManager& scorePoolManager)
64 : scorePoolManager_(scorePoolManager) {}

Public Member Functions

update()

void helios::engine::mechanics::scoring::systems::ScoreObserverSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Updates all active ScoreObserverComponents with current score data.

Compares each observer's cached revision against the pool's current revision. On mismatch, propagates the pool's snapshot to the component.

Parameters
updateContext

The current frame's update context.

Definition at line 74 of file ScoreObserverSystem.ixx.

75
76 for (auto [entity, soc, active] : updateContext.view<
79 >().whereEnabled()) {
80
81 const auto scorePoolId = soc->scorePoolId();
82 auto* scorePool = scorePoolManager_.scorePool(scorePoolId);
83
84 if (!scorePool) {
85 continue;
86 }
87
88 if (soc->scorePoolRevision() != scorePool->revision()) {
89 soc->setScorePoolSnapshot(scorePool->snapshot());
90 }
91
92 }
93
94 }

Private Member Attributes

scorePoolManager_

ScorePoolManager& helios::engine::mechanics::scoring::systems::ScoreObserverSystem::scorePoolManager_

Reference to the ScorePoolManager that owns the score pools.

Definition at line 52 of file ScoreObserverSystem.ixx.

52 ScorePoolManager& scorePoolManager_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.