Skip to main content

SpawnInitializer.ixx File

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

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacespawn

Entity spawning infrastructure for the helios engine. More...

namespacebehavior

Spawn behavior strategies for positioning and initializing entities. More...

Classes Index

classSpawnInitializer

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

Description

Abstract interface for initializing spawned entity state.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file SpawnInitializer.ixx
3 * @brief Abstract interface for initializing spawned entity state.
4 */
5module;
6
7export module helios.engine.runtime.spawn.behavior.SpawnInitializer;
8
9import helios.engine.runtime.spawn.types.SpawnPlanCursor;
10import helios.engine.runtime.spawn.types.SpawnContext;
11import helios.engine.ecs.GameObject;
12
15
16 /**
17 * @brief Abstract interface for initializing spawned entity state.
18 *
19 * @details SpawnInitializer defines the strategy for configuring a spawned
20 * entity's components after it has been placed. Implementations can set
21 * velocity, direction, stats, or any other entity-specific state.
22 *
23 * Common implementations:
24 *
25 * - **ProjectileInitializer:** Sets velocity and direction
26 * - **EnemyInitializer:** Configures health, AI state, behavior
27 * - **PickupInitializer:** Sets pickup type and value
28 *
29 * Example implementation:
30 * ```cpp
31 * class ProjectileInitializer : public SpawnInitializer {
32 * float speed_;
33 * public:
34 * explicit ProjectileInitializer(float speed) : speed_(speed) {}
35 *
36 * void initialize(const GameObject go, const SpawnPlanCursor& cursor,
37 * const SpawnContext& ctx) override {
38 * if (auto* dir = go.get<DirectionComponent>()) {
39 * dir->setDirection(ctx.emitterContext->velocity.normalized());
40 * }
41 * if (auto* move = go.get<Move2DComponent>()) {
42 * move->setSpeed(speed_);
43 * }
44 * }
45 * };
46 * ```
47 *
48 * @see SpawnProfile
49 * @see SpawnPlacer
50 * @see SpawnContext
51 */
53
54 public:
55
56 virtual ~SpawnInitializer() = default;
57
58 /**
59 * @brief Initializes a spawned entity's state.
60 *
61 * @param gameObject The entity to initialize.
62 * @param cursor The current position within the spawn batch.
63 * @param spawnContext Context data including optional emitter info.
64 */
65 virtual void initialize(
67 const SpawnPlanCursor& cursor,
68 const SpawnContext& spawnContext
69 ) = 0;
70
71 /**
72 * @brief Called when the spawn system is reset.
73 *
74 * @details Override to reset any internal state (e.g., RNG seeds).
75 * The default implementation is a no-op.
76 */
77 virtual void onReset() noexcept {
78
79 }
80
81 };
82
83}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.