DelayedComponentEnabler Class Template
Component that manages delayed activation of other components. More...
Declaration
Public Constructors Index
template <typename THandle> | |
| DelayedComponentEnabler ()=default | |
|
Default constructor. More... | |
template <typename THandle> | |
| DelayedComponentEnabler (const DelayedComponentEnabler &other) | |
|
Copy constructor for cloning during spawn. More... | |
template <typename THandle> | |
| DelayedComponentEnabler (DelayedComponentEnabler &&) noexcept=default | |
Public Operators Index
template <typename THandle> | |
| DelayedComponentEnabler & | operator= (const DelayedComponentEnabler &)=default |
template <typename THandle> | |
| DelayedComponentEnabler & | operator= (DelayedComponentEnabler &&) noexcept=default |
Public Member Functions Index
template <typename THandle> | |
| auto | deferredComponents () noexcept -> std::span< DeferredComponent > |
|
Returns a view of all currently deferred components. More... | |
template <typename THandle> | |
| void | sync (std::span< helios::ecs::types::ComponentTypeId< THandle > > removeList) |
|
Removes activated components from the deferred list. More... | |
template <typename TEntity> | |
| void | defer (TEntity entity, helios::ecs::types::ComponentTypeId< THandle > componentTypeId, const float delta) |
|
Schedules a component for delayed activation. More... | |
Private Member Attributes Index
template <typename THandle> | |
| std::vector< DeferredComponent > | deferredComponents_ |
|
List of components pending delayed activation. More... | |
Description
Component that manages delayed activation of other components.
DelayedComponentEnabler maintains a list of components that should be activated after a specified delay. This is useful for runtime patterns where newly spawned entities need temporary immunity or staggered activation:
- Collision immunity: Projectiles ignore collisions briefly after spawn
- AI warmup: Behavior components activate after positioning completes
- Visual fade-in: Rendering components enable after spawn effects
- Staggered waves: Sequential entities activate progressively
The component works in conjunction with DelayedComponentEnablerSystem, which decrements timers each frame and enables components when their delay expires.
Components are disabled immediately when deferred and re-enabled automatically by the system when the delay reaches zero.
- See Also
DelayedComponentEnablerSystem
- See Also
Definition at line 42 of file DelayedComponentEnabler.ixx.
Public Constructors
DelayedComponentEnabler()
| default |
Default constructor.
Definition at line 69 of file DelayedComponentEnabler.ixx.
DelayedComponentEnabler()
| inline |
Copy constructor for cloning during spawn.
- Parameters
-
other The source component to copy from.
Definition at line 76 of file DelayedComponentEnabler.ixx.
DelayedComponentEnabler()
| noexcept default |
Definition at line 80 of file DelayedComponentEnabler.ixx.
Public Operators
operator=()
| default |
Definition at line 79 of file DelayedComponentEnabler.ixx.
operator=()
| noexcept default |
Definition at line 81 of file DelayedComponentEnabler.ixx.
Public Member Functions
defer()
| inline |
Schedules a component for delayed activation.
The specified component is immediately disabled and added to the deferred list. If the component is already deferred, its delay is updated to the new value.
- Parameters
-
componentTypeId Type identifier of the component to defer.
delta Delay in seconds before activation.
Asserts if delta <= 0 or if the component does not exist on the entity.
Definition at line 119 of file DelayedComponentEnabler.ixx.
Reference helios::engine::runtime::lifecycle::registerComponents.
deferredComponents()
| inline noexcept |
Returns a view of all currently deferred components.
- Returns
Span of DeferredComponent entries with remaining delays.
Definition at line 88 of file DelayedComponentEnabler.ixx.
sync()
| inline |
Removes activated components from the deferred list.
Called by the system after enabling components to clean up entries that have completed their delay period.
- Parameters
-
removeList Component type IDs to remove from tracking.
Definition at line 100 of file DelayedComponentEnabler.ixx.
Reference helios::engine::runtime::lifecycle::registerComponents.
Private Member Attributes
deferredComponents_
|
List of components pending delayed activation.
Definition at line 62 of file DelayedComponentEnabler.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.