Skip to main content

GameObjectSpawnSystem Class

Declaration

class helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem { ... }

Public Member Typedefs Index

usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors Index

GameObjectSpawnSystem (helios::engine::runtime::spawn::SpawnManager &spawnManager) noexcept

Public Member Functions Index

voidinit (GameWorld &gameWorld) noexcept
voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept

Processes spawn scheduling and enqueues spawn commands. More...

Private Member Attributes Index

helios::engine::runtime::spawn::SpawnManager &spawnManager_
GameWorld *gameWorld_ = nullptr

Definition at line 31 of file GameObjectSpawnSystem.ixx.

Public Member Typedefs

EngineRoleTag

using helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors

GameObjectSpawnSystem()

helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem::GameObjectSpawnSystem (helios::engine::runtime::spawn::SpawnManager & spawnManager)
inline explicit noexcept

Definition at line 43 of file GameObjectSpawnSystem.ixx.

44 : spawnManager_{spawnManager} {}

Public Member Functions

init()

void helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem::init (GameWorld & gameWorld)
inline noexcept

Definition at line 47 of file GameObjectSpawnSystem.ixx.

47 void init(GameWorld& gameWorld) noexcept {
48 gameWorld_ = &gameWorld;
49 }

update()

void helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Processes spawn scheduling and enqueues spawn commands.

Iterates through all schedulers and performs these steps for each: 1. Reads `SpawnPlanCommandExecutedEvent` from frame event bus 2. Commits completed spawns to the scheduler (for tracking/cooldowns) 3. Evaluates all spawn rules against current conditions 4. Drains ready spawn plans and enqueues them as commands

Parameters
updateContext

The current frame's update context.

Definition at line 62 of file GameObjectSpawnSystem.ixx.

63
64 const auto& events = updateContext.readFrame<
66 >();
67
68 for (const auto& spawnScheduler : spawnManager_.spawnSchedulers()) {
69
70 /**
71 * @todo this should be processed before iterating over all schedulers: A scheduler owns the rule,
72 * hence a rule that triggered the event's can be associated with the owning Scheduler, making it
73 * unneccesary to iterate over already processed events
74 */
75 for (const auto& event : events) {
76 spawnScheduler->commit(event.spawnRuleId, event.spawnCount);
77 }
78
79 spawnScheduler->evaluate(*gameWorld_, updateContext);
80
81 auto scheduledPlans = spawnScheduler->drainScheduledPlans();
82
83 for (auto& plan : scheduledPlans) {
84 updateContext.queueCommand<
86 >(
87 plan.spawnProfileId, plan.spawnPlan, plan.spawnContext
88 );
89 }
90 }
91
92 }

Private Member Attributes

gameWorld_

GameWorld* helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem::gameWorld_ = nullptr

Definition at line 36 of file GameObjectSpawnSystem.ixx.

36 GameWorld* gameWorld_ = nullptr;

spawnManager_

helios::engine::runtime::spawn::SpawnManager& helios::engine::mechanics::spawn::systems::GameObjectSpawnSystem::spawnManager_

Definition at line 34 of file GameObjectSpawnSystem.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.