Skip to main content

MaxScoreObserverSystem Class

System that propagates high score snapshots to MaxScoreObserverComponents. More...

Declaration

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

Public Member Typedefs Index

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

Public Constructors Index

MaxScoreObserverSystem (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 MaxScoreObserverComponents with current high score data. More...

Private Member Attributes Index

ScorePoolManager &scorePoolManager_

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

Description

System that propagates high score snapshots to MaxScoreObserverComponents.

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

See Also

MaxScoreObserverClearSystem

See Also

MaxScoreObserverComponent

See Also

ScorePoolManager

Definition at line 48 of file MaxScoreObserverSystem.ixx.

Public Member Typedefs

EngineRoleTag

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

Public Constructors

MaxScoreObserverSystem()

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

Constructs the system with a reference to the ScorePoolManager.

Parameters
scorePoolManager

The ScorePoolManager providing score pool state.

Definition at line 64 of file MaxScoreObserverSystem.ixx.

64 explicit MaxScoreObserverSystem(ScorePoolManager& scorePoolManager)
65 : scorePoolManager_(scorePoolManager) {}

Public Member Functions

update()

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

Updates all active MaxScoreObserverComponents with current high score data.

Parameters
updateContext

The current frame's update context.

Definition at line 72 of file MaxScoreObserverSystem.ixx.

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

Private Member Attributes

scorePoolManager_

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

Reference to the ScorePoolManager that owns the score pools.

Definition at line 53 of file MaxScoreObserverSystem.ixx.

53 ScorePoolManager& scorePoolManager_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.