SpawnInitializer Class
Abstract interface for initializing spawned entity state. More...
Declaration
Derived Classes
| class | DelayedComponentEnablerInitializer<ComponentTypes> |
|
Initializer that schedules delayed activation of arbitrary components. More... | |
| class | EmitterInitializer |
|
Initializer that configures spawned entities based on emitter state. More... | |
| class | InitializerList<N> |
|
Composite initializer that executes multiple SpawnInitializers in sequence. More... | |
| class | MoveInitializer |
|
Initializer that sets movement direction for spawned entities. More... | |
| class | RandomDirectionInitializer |
|
Initializer that configures spawned entities with random direction. More... | |
Public Destructor Index
| ~SpawnInitializer ()=default | |
Public Member Functions Index
| void | initialize (helios::engine::ecs::GameObject gameObject, const SpawnPlanCursor &cursor, const SpawnContext &spawnContext)=0 |
|
Initializes a spawned entity's state. More... | |
| void | onReset () noexcept |
|
Called when the spawn system is reset. More... | |
Description
Abstract interface for initializing spawned entity state.
SpawnInitializer defines the strategy for configuring a spawned entity's components after it has been placed. Implementations can set velocity, direction, stats, or any other entity-specific state.
Common implementations:
- **ProjectileInitializer:** Sets velocity and direction
- **EnemyInitializer:** Configures health, AI state, behavior
- **PickupInitializer:** Sets pickup type and value
Example implementation: ```cpp class ProjectileInitializer : public SpawnInitializer { float speed_; public: explicit ProjectileInitializer(float speed) : speed_(speed) {}
void initialize(const GameObject go, const SpawnPlanCursor& cursor, const SpawnContext& ctx) override { if (auto* dir = go.get<DirectionComponent>()) { dir->setDirection(ctx.emitterContext->velocity.normalized()); } if (auto* move = go.get<Move2DComponent>()) { move->setSpeed(speed_); } } }; ```
- See Also
- See Also
- See Also
Definition at line 52 of file SpawnInitializer.ixx.
Public Destructor
~SpawnInitializer()
| virtual default |
Definition at line 56 of file SpawnInitializer.ixx.
Public Member Functions
initialize()
|
Initializes a spawned entity's state.
- Parameters
-
gameObject The entity to initialize.
cursor The current position within the spawn batch.
spawnContext Context data including optional emitter info.
Definition at line 65 of file SpawnInitializer.ixx.
onReset()
| inline noexcept virtual |
Called when the spawn system is reset.
Override to reset any internal state (e.g., RNG seeds). The default implementation is a no-op.
Definition at line 77 of file SpawnInitializer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.