Skip to main content

DelayedComponentEnablerSystem Class

System that processes delayed component activations each frame. More...

Declaration

class helios::engine::mechanics::lifecycle::systems::DelayedComponentEnablerSystem { ... }

Base class

classSystem

Abstract base class for game systems. More...

Public Member Functions Index

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

Processes all deferred components and activates expired ones. More...

Private Member Attributes Index

std::vector< helios::engine::core::data::ComponentTypeId >sync_

Temporary buffer for components that completed their delay. More...

Description

System that processes delayed component activations each frame.

DelayedComponentEnablerSystem iterates over all entities with a DelayedComponentEnabler component and decrements the delay timers. When a timer reaches zero, the corresponding component is enabled.

This system enables gameplay patterns such as:

  • **Spawn immunity:** Projectiles/enemies ignore collisions briefly
  • **Staggered activation:** Wave spawns activate progressively
  • **Effect sequencing:** Components enable in a defined order
info

Should be scheduled in the gameplay phase to ensure proper timing.

See Also

DelayedComponentEnabler

See Also

DelayedComponentEnablerInitializer

Definition at line 41 of file DelayedComponentEnablerSystem.ixx.

Public Member Functions

update()

void helios::engine::mechanics::lifecycle::systems::DelayedComponentEnablerSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept virtual

Processes all deferred components and activates expired ones.

For each entity with DelayedComponentEnabler: 1. Decrements all delay timers by deltaTime 2. Enables components whose timers reach zero 3. Removes activated components from the deferred list

Parameters
updateContext

Provides deltaTime for timer updates.

Definition at line 60 of file DelayedComponentEnablerSystem.ixx.

60 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept override {
61
62 const float delta = updateContext.deltaTime();
63
64 for (auto [entity, dce, active] : gameWorld_->view<
67 >().whereEnabled()) {
68
69 sync_.clear();
70
71 auto deferredComponents = dce->deferredComponents();
72
73 for (auto& deferredComponent : deferredComponents) {
74
75 deferredComponent.delta = std::max(deferredComponent.delta - delta, 0.0f);
76
77 const auto componentTypeId = deferredComponent.componentTypeId;
78
79 if (deferredComponent.delta <= 0) {
80 auto* rawCmp = entity.raw(componentTypeId);
81 auto ops = helios::engine::ecs::ComponentOpsRegistry::ops(componentTypeId);
82
83 if (rawCmp && ops.enable) {
84 ops.enable(rawCmp);
85 }
86
87 sync_.push_back(componentTypeId);
88 }
89 }
90
91 dce->sync(sync_);
92 }
93 }

References helios::engine::ecs::System::gameWorld_ and helios::engine::ecs::ComponentOpsRegistry::ops.

Private Member Attributes

sync_

std::vector<helios::engine::core::data::ComponentTypeId> helios::engine::mechanics::lifecycle::systems::DelayedComponentEnablerSystem::sync_

Temporary buffer for components that completed their delay.

Definition at line 46 of file DelayedComponentEnablerSystem.ixx.

46 std::vector<helios::engine::core::data::ComponentTypeId> sync_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.