DelayedComponentEnablerInitializer Class Template
Initializer that schedules delayed activation of arbitrary components. More...
Declaration
Base class
| class | SpawnInitializer |
|
Abstract interface for initializing spawned entity state. More... | |
Public Constructors Index
template <typename... ComponentTypes> | |
| DelayedComponentEnablerInitializer (const float delay, const size_t cycleLength=0) | |
|
Constructs the initializer with delay and optional cycle length. More... | |
Public Member Functions Index
template <typename... ComponentTypes> | |
| void | initialize (helios::engine::ecs::GameObject gameObject, const SpawnPlanCursor &cursor, const SpawnContext &spawnContext) override |
|
Schedules delayed activation of the configured component types. More... | |
Private Member Attributes Index
template <typename... ComponentTypes> | |
| const float | delay_ |
|
Base delay in seconds between activations. More... | |
template <typename... ComponentTypes> | |
| const size_t | cycleLength_ |
|
Cycle length for repeating delay patterns. More... | |
template <typename... ComponentTypes> | |
| std::vector< helios::engine::ecs::types::ComponentTypeId > | deferredComponents_ |
|
Type IDs of components whose activation should be deferred. More... | |
Description
Initializer that schedules delayed activation of arbitrary components.
DelayedComponentEnablerInitializer defers the activation of specified components until a calculated delay has elapsed. This enables gameplay patterns such as:
- **Collision immunity:** Newly spawned entities ignore collisions briefly
- **Visibility fade-in:** Rendering components activate after spawn animation
- **AI activation:** Behavior components enable after entity is fully placed
- **Staggered waves:** Sequential spawns activate progressively
The delay for each entity is calculated as: `delay = (batchPosition + 1) * baseDelay`
An optional cycle length resets the batch position via modulo, useful for repeating spawn patterns where delay should not grow indefinitely.
- Template Parameters
-
ComponentTypes The component types whose activation should be deferred.
The entity must have a DelayedComponentEnabler component attached. The specified ComponentTypes must exist on the entity.
- See Also
- See Also
DelayedComponentEnabler
Definition at line 51 of file DelayedComponentEnablerInitializer.ixx.
Public Constructors
DelayedComponentEnablerInitializer()
| inline |
Constructs the initializer with delay and optional cycle length.
- Parameters
-
delay Base delay in seconds between each activation step.
cycleLength Number of positions before the delay pattern repeats. Zero means no cycling (default).
Definition at line 80 of file DelayedComponentEnablerInitializer.ixx.
Public Member Functions
initialize()
| inline virtual |
Schedules delayed activation of the configured component types.
Searches the entity's components for matches against the template ComponentTypes. Each matching component is registered with the entity's DelayedComponentEnabler for deferred activation. The delay duration depends on the spawn batch position and the configured base delay.
- Parameters
-
gameObject The entity to initialize.
cursor Provides batch position for delay calculation.
spawnContext Context data (unused).
Definition at line 98 of file DelayedComponentEnablerInitializer.ixx.
References helios::engine::ecs::GameObject::componentTypeIds, helios::engine::ecs::GameObject::get and helios::engine::runtime::spawn::types::SpawnPlanCursor::position.
Private Member Attributes
cycleLength_
|
Cycle length for repeating delay patterns.
If non-zero, position indices wrap around after this many spawns. If zero, positions increase indefinitely.
Definition at line 64 of file DelayedComponentEnablerInitializer.ixx.
deferredComponents_
|
Type IDs of components whose activation should be deferred.
Definition at line 69 of file DelayedComponentEnablerInitializer.ixx.
delay_
|
Base delay in seconds between activations.
Definition at line 56 of file DelayedComponentEnablerInitializer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.