Skip to main content

SpawnInitializer Class

Abstract interface for initializing spawned entity state. More...

Declaration

class helios::engine::runtime::spawn::behavior::SpawnInitializer { ... }

Derived Classes

classDelayedComponentEnablerInitializer<ComponentTypes>

Initializer that schedules delayed activation of arbitrary components. More...

classEmitterInitializer

Initializer that configures spawned entities based on emitter state. More...

classInitializerList<N>

Composite initializer that executes multiple SpawnInitializers in sequence. More...

classMoveInitializer

Initializer that sets movement direction for spawned entities. More...

classRandomDirectionInitializer

Initializer that configures spawned entities with random direction. More...

Public Destructor Index

~SpawnInitializer ()=default

Public Member Functions Index

voidinitialize (helios::engine::ecs::GameObject gameObject, const SpawnPlanCursor &cursor, const SpawnContext &spawnContext)=0

Initializes a spawned entity's state. More...

voidonReset () 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

SpawnProfile

See Also

SpawnPlacer

See Also

SpawnContext

Definition at line 52 of file SpawnInitializer.ixx.

Public Destructor

~SpawnInitializer()

virtual helios::engine::runtime::spawn::behavior::SpawnInitializer::~SpawnInitializer ()
virtual default

Definition at line 56 of file SpawnInitializer.ixx.

Public Member Functions

initialize()

virtual void helios::engine::runtime::spawn::behavior::SpawnInitializer::initialize (helios::engine::ecs::GameObject gameObject, const SpawnPlanCursor & cursor, const SpawnContext & spawnContext)

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()

virtual void helios::engine::runtime::spawn::behavior::SpawnInitializer::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.

77 virtual void onReset() noexcept {
78
79 }

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.