Skip to main content

SpawnProfileConfig Class

Fluent configuration for a spawn profile bound to a pool. More...

Declaration

class helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig { ... }

Public Constructors Index

SpawnProfileConfig (SpawnPoolConfig &parent, helios::engine::runtime::spawn::SpawnManager &spawnManager, helios::engine::runtime::spawn::types::SpawnProfileId profileId, helios::engine::runtime::pooling::types::GameObjectPoolId poolId)

Constructs a SpawnProfileConfig. More...

Public Member Functions Index

SpawnProfileConfig &emitterPlacement ()

Configures emitter-relative placement and initialization. More...

SpawnProfileConfig &randomPlacement ()

Configures random placement within level bounds. More...

SpawnProfileConfig &axisPlacement (const helios::math::vec3f &axis, const helios::math::vec3f &origin)

Configures axis-aligned placement. More...

SpawnProfileConfig &placer (std::unique_ptr< helios::engine::runtime::spawn::behavior::SpawnPlacer > customPlacer)

Sets a custom spawn placer. More...

SpawnProfileConfig &randomDirectionInitializer ()

Configures a move initializer with random direction. More...

SpawnProfileConfig &moveInitializer (const helios::math::vec3f &direction)

Configures a move initializer with a fixed direction. More...

SpawnProfileConfig &initializer (std::unique_ptr< helios::engine::runtime::spawn::behavior::SpawnInitializer > customInitializer)

Sets a custom spawn initializer. More...

SpawnRuleConfig &scheduledBy (helios::engine::runtime::spawn::types::SpawnRuleId ruleId)

Begins configuration of a scheduled spawn rule for this profile. More...

helios::engine::runtime::spawn::types::SpawnProfileIdprofileId () const noexcept

Returns the profile ID. More...

std::vector< std::pair< helios::engine::runtime::spawn::types::SpawnProfileId, std::unique_ptr< helios::engine::runtime::spawn::policy::SpawnRule > > >commit ()

Commits the profile and builds any associated rules. More...

SpawnPoolConfig &done ()

Finalizes the profile and returns to the parent pool config. More...

Private Member Attributes Index

SpawnPoolConfig &parent_

Parent pool this profile belongs to. More...

helios::engine::runtime::spawn::SpawnManager &spawnManager_

The spawn manager to register with. More...

helios::engine::runtime::spawn::types::SpawnProfileIdprofileId_

Profile identifier. More...

helios::engine::runtime::pooling::types::GameObjectPoolIdpoolId_

Pool to acquire entities from. More...

std::unique_ptr< helios::engine::runtime::spawn::behavior::SpawnPlacer >placer_

Placement strategy for spawned entities. More...

std::unique_ptr< helios::engine::runtime::spawn::behavior::SpawnInitializer >initializer_

Initialization strategy for spawned entities. More...

std::vector< std::unique_ptr< SpawnRuleConfig > >rules_

Scheduled rules for this profile. More...

Description

Fluent configuration for a spawn profile bound to a pool.

Configures placement, initialization, and optional scheduling rules for a specific spawn profile. Returns to the parent SpawnPoolConfig via done().

Definition at line 225 of file SpawnPoolConfig.ixx.

Public Constructors

SpawnProfileConfig()

helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::SpawnProfileConfig (SpawnPoolConfig & parent, helios::engine::runtime::spawn::SpawnManager & spawnManager, helios::engine::runtime::spawn::types::SpawnProfileId profileId, helios::engine::runtime::pooling::types::GameObjectPoolId poolId)
inline

Constructs a SpawnProfileConfig.

Parameters
parent

The parent pool config.

spawnManager

The spawn manager to register profiles with.

profileId

Unique identifier for the profile.

poolId

Pool from which entities are acquired.

Definition at line 272 of file SpawnPoolConfig.ixx.

273 SpawnPoolConfig& parent,
277 ) : parent_(parent), spawnManager_(spawnManager),
278 profileId_(profileId), poolId_(poolId) {}

Reference profileId.

Referenced by axisPlacement, emitterPlacement, initializer, moveInitializer, placer, randomDirectionInitializer and randomPlacement.

Public Member Functions

axisPlacement()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::axisPlacement (const helios::math::vec3f & axis, const helios::math::vec3f & origin)
inline

Configures axis-aligned placement.

Parameters
axis

Direction axis for spawn distribution.

origin

Starting point of the axis.

Returns

Reference to this config for chaining.

Definition at line 312 of file SpawnPoolConfig.ixx.

313 const helios::math::vec3f& axis,
314 const helios::math::vec3f& origin
315 ) {
316 placer_ = std::make_unique<
318 return *this;
319 }

Reference SpawnProfileConfig.

commit()

std::vector< std::pair< helios::engine::runtime::spawn::types::SpawnProfileId, std::unique_ptr< helios::engine::runtime::spawn::policy::SpawnRule > > > helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::commit ()
inline

Commits the profile and builds any associated rules.

Returns

Vector of built spawn rules (may be empty).

Definition at line 402 of file SpawnPoolConfig.ixx.

403 spawnManager_.addSpawnProfile(
404 profileId_,
405 std::make_unique<SpawnProfile>(
407 .gameObjectPoolId = poolId_,
408 .spawnPlacer = std::move(placer_),
409 .spawnInitializer = std::move(initializer_)
410 }
411 )
412 );
413
415 std::unique_ptr<helios::engine::runtime::spawn::policy::SpawnRule>>> result;
416 for (auto& rule : rules_) {
417 result.emplace_back(profileId_, rule->build());
418 }
419 return result;
420 }

done()

SpawnPoolConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::done ()
inline

Finalizes the profile and returns to the parent pool config.

Returns

Reference to the parent SpawnPoolConfig.

Definition at line 427 of file SpawnPoolConfig.ixx.

628 return parent_;
629 }

emitterPlacement()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::emitterPlacement ()
inline

Configures emitter-relative placement and initialization.

Returns

Reference to this config for chaining.

Definition at line 285 of file SpawnPoolConfig.ixx.

Reference SpawnProfileConfig.

initializer()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::initializer (std::unique_ptr< helios::engine::runtime::spawn::behavior::SpawnInitializer > customInitializer)
inline

Sets a custom spawn initializer.

Parameters
customInitializer

Ownership is transferred.

Returns

Reference to this config for chaining.

Definition at line 367 of file SpawnPoolConfig.ixx.

368 std::unique_ptr<helios::engine::runtime::spawn::behavior::SpawnInitializer> customInitializer
369 ) {
370 initializer_ = std::move(customInitializer);
371 return *this;
372 }

Reference SpawnProfileConfig.

moveInitializer()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::moveInitializer (const helios::math::vec3f & direction)
inline

Configures a move initializer with a fixed direction.

Parameters
direction

The movement direction.

Returns

Reference to this config for chaining.

Definition at line 354 of file SpawnPoolConfig.ixx.

355 initializer_ = std::make_unique<
357 return *this;
358 }

Reference SpawnProfileConfig.

placer()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::placer (std::unique_ptr< helios::engine::runtime::spawn::behavior::SpawnPlacer > customPlacer)
inline

Sets a custom spawn placer.

Parameters
customPlacer

Ownership is transferred.

Returns

Reference to this config for chaining.

Definition at line 328 of file SpawnPoolConfig.ixx.

329 std::unique_ptr<helios::engine::runtime::spawn::behavior::SpawnPlacer> customPlacer
330 ) {
331 placer_ = std::move(customPlacer);
332 return *this;
333 }

Reference SpawnProfileConfig.

profileId()

helios::engine::runtime::spawn::types::SpawnProfileId helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::profileId ()
inline nodiscard noexcept

Returns the profile ID.

Returns

The spawn profile ID.

Definition at line 391 of file SpawnPoolConfig.ixx.

392 return profileId_;
393 }

Referenced by SpawnProfileConfig.

randomDirectionInitializer()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::randomDirectionInitializer ()
inline

Configures a move initializer with random direction.

Returns

Reference to this config for chaining.

Definition at line 340 of file SpawnPoolConfig.ixx.

References helios::engine::runtime::spawn::behavior::initializers::Random and SpawnProfileConfig.

randomPlacement()

SpawnProfileConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::randomPlacement ()
inline

Configures random placement within level bounds.

Returns

Reference to this config for chaining.

Definition at line 298 of file SpawnPoolConfig.ixx.

299 placer_ = std::make_unique<
301 return *this;
302 }

Reference SpawnProfileConfig.

scheduledBy()

SpawnRuleConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::scheduledBy (helios::engine::runtime::spawn::types::SpawnRuleId ruleId)
inline

Begins configuration of a scheduled spawn rule for this profile.

Parameters
ruleId

Unique identifier for the rule.

Returns

Reference to the new rule config for chaining.

Definition at line 381 of file SpawnPoolConfig.ixx.

382 rules_.push_back(std::make_unique<SpawnRuleConfig>(*this, ruleId));
383 return *rules_.back();
384 }

Private Member Attributes

initializer_

std::unique_ptr<helios::engine::runtime::spawn::behavior::SpawnInitializer> helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::initializer_

Initialization strategy for spawned entities.

Definition at line 255 of file SpawnPoolConfig.ixx.

255 std::unique_ptr<helios::engine::runtime::spawn::behavior::SpawnInitializer> initializer_;

parent_

SpawnPoolConfig& helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::parent_

Parent pool this profile belongs to.

Definition at line 230 of file SpawnPoolConfig.ixx.

230 SpawnPoolConfig& parent_;

placer_

std::unique_ptr<helios::engine::runtime::spawn::behavior::SpawnPlacer> helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::placer_

Placement strategy for spawned entities.

Definition at line 250 of file SpawnPoolConfig.ixx.

250 std::unique_ptr<helios::engine::runtime::spawn::behavior::SpawnPlacer> placer_;

poolId_

helios::engine::runtime::pooling::types::GameObjectPoolId helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::poolId_

Pool to acquire entities from.

Definition at line 245 of file SpawnPoolConfig.ixx.

profileId_

helios::engine::runtime::spawn::types::SpawnProfileId helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::profileId_

Profile identifier.

Definition at line 240 of file SpawnPoolConfig.ixx.

rules_

std::vector<std::unique_ptr<SpawnRuleConfig> > helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::rules_

Scheduled rules for this profile.

Definition at line 260 of file SpawnPoolConfig.ixx.

260 std::vector<std::unique_ptr<SpawnRuleConfig>> rules_;

spawnManager_

helios::engine::runtime::spawn::SpawnManager& helios::engine::builder::spawnSystem::builders::configs::SpawnProfileConfig::spawnManager_

The spawn manager to register with.

Definition at line 235 of file SpawnPoolConfig.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.