DelayedComponentEnabler Class
Component that manages delayed activation of other components. More...
Declaration
Public Constructors Index
| DelayedComponentEnabler ()=default | |
|
Default constructor. More... | |
| DelayedComponentEnabler (const DelayedComponentEnabler &other) | |
|
Copy constructor for cloning during spawn. More... | |
| DelayedComponentEnabler (DelayedComponentEnabler &&) noexcept=default | |
Public Operators Index
| DelayedComponentEnabler & | operator= (const DelayedComponentEnabler &)=default |
| DelayedComponentEnabler & | operator= (DelayedComponentEnabler &&) noexcept=default |
Public Member Functions Index
| std::span< DeferredComponent > | deferredComponents () noexcept |
|
Returns a view of all currently deferred components. More... | |
| void | sync (std::span< helios::engine::core::data::ComponentTypeId > removeList) |
|
Removes activated components from the deferred list. More... | |
| void | defer (helios::engine::ecs::GameObject gameObject, helios::engine::core::data::ComponentTypeId componentTypeId, const float delta) |
|
Schedules a component for delayed activation. More... | |
Private Member Attributes Index
| 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 gameplay 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
DelayedComponentEnablerInitializer
Definition at line 44 of file DelayedComponentEnabler.ixx.
Public Constructors
DelayedComponentEnabler()
| default |
Default constructor.
Definition at line 71 of file DelayedComponentEnabler.ixx.
Referenced by DelayedComponentEnabler, DelayedComponentEnabler, operator= and operator=.
DelayedComponentEnabler()
| inline |
Copy constructor for cloning during spawn.
- Parameters
-
other The source component to copy from.
Definition at line 78 of file DelayedComponentEnabler.ixx.
Reference DelayedComponentEnabler.
DelayedComponentEnabler()
| noexcept default |
Definition at line 82 of file DelayedComponentEnabler.ixx.
Reference DelayedComponentEnabler.
Public Operators
operator=()
| default |
Definition at line 81 of file DelayedComponentEnabler.ixx.
Reference DelayedComponentEnabler.
operator=()
| noexcept default |
Definition at line 83 of file DelayedComponentEnabler.ixx.
Reference DelayedComponentEnabler.
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 120 of file DelayedComponentEnabler.ixx.
References helios::engine::ecs::GameObject::disableComponent and helios::engine::ecs::GameObject::has.
deferredComponents()
| inline noexcept |
Returns a view of all currently deferred components.
- Returns
Span of DeferredComponent entries with remaining delays.
Definition at line 90 of file DelayedComponentEnabler.ixx.
Reference deferredComponents.
Referenced by deferredComponents.
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 102 of file DelayedComponentEnabler.ixx.
Private Member Attributes
deferredComponents_
|
List of components pending delayed activation.
Definition at line 64 of file DelayedComponentEnabler.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.