Skip to main content

SpawnRuleConfig Class

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

Declaration

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

Public Constructors Index

SpawnRuleConfig (SpawnProfileConfig &parent, helios::engine::runtime::spawn::types::SpawnRuleId ruleId)

Constructs a SpawnRuleConfig. More...

Public Member Functions Index

SpawnRuleConfig &timerCondition (const float intervalSeconds)

Sets a timer-based spawn condition. More...

SpawnRuleConfig &timerWithAvailabilityCondition (const float intervalSeconds)

Sets a combined condition: timer + pool availability. More...

SpawnRuleConfig &condition (std::unique_ptr< const helios::engine::runtime::spawn::policy::SpawnCondition > customCondition)

Sets a custom spawn condition. More...

SpawnRuleConfig &fixedAmount (const size_t count)

Sets a fixed spawn amount. More...

SpawnRuleConfig &amount (std::unique_ptr< const helios::engine::runtime::spawn::policy::amount::SpawnAmountProvider > customProvider)

Sets a custom amount provider. More...

std::unique_ptr< helios::engine::runtime::spawn::policy::SpawnRule >build ()

Builds the SpawnRule from this configuration. More...

SpawnProfileConfig &done ()

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

Private Member Attributes Index

SpawnProfileConfig &parent_

Parent profile this rule belongs to. More...

helios::engine::runtime::spawn::types::SpawnRuleIdruleId_

Unique identifier for this rule. More...

std::unique_ptr< const helios::engine::runtime::spawn::policy::SpawnCondition >condition_

Condition determining when to spawn. More...

std::unique_ptr< const helios::engine::runtime::spawn::policy::amount::SpawnAmountProvider >amountProvider_

Provider determining how many to spawn. More...

Description

Fluent configuration for a spawn rule bound to a profile.

Configures the condition and amount for a scheduled spawn rule. Returns to the parent SpawnProfileConfig via done().

Definition at line 90 of file SpawnPoolConfig.ixx.

Public Constructors

SpawnRuleConfig()

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

Constructs a SpawnRuleConfig.

Parameters
parent

The parent profile config.

ruleId

Unique identifier for this rule.

Definition at line 120 of file SpawnPoolConfig.ixx.

121 SpawnProfileConfig& parent,
123 ) : parent_(parent), ruleId_(ruleId),
124 condition_(nullptr), amountProvider_(nullptr) {}

Referenced by amount, condition, fixedAmount, timerCondition and timerWithAvailabilityCondition.

Public Member Functions

amount()

SpawnRuleConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::amount (std::unique_ptr< const helios::engine::runtime::spawn::policy::amount::SpawnAmountProvider > customProvider)
inline

Sets a custom amount provider.

Parameters
customProvider

Ownership is transferred.

Returns

Reference to this config for chaining.

Definition at line 190 of file SpawnPoolConfig.ixx.

191 std::unique_ptr<const helios::engine::runtime::spawn::policy::amount::SpawnAmountProvider> customProvider
192 ) {
193 amountProvider_ = std::move(customProvider);
194 return *this;
195 }

Reference SpawnRuleConfig.

build()

std::unique_ptr< helios::engine::runtime::spawn::policy::SpawnRule > helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::build ()
inline nodiscard

Builds the SpawnRule from this configuration.

Returns

The assembled SpawnRule.

Definition at line 202 of file SpawnPoolConfig.ixx.

202 [[nodiscard]] std::unique_ptr<helios::engine::runtime::spawn::policy::SpawnRule> build() {
203 return std::make_unique<helios::engine::runtime::spawn::policy::SpawnRule>(
204 std::move(condition_),
205 std::move(amountProvider_),
206 ruleId_
207 );
208 }

condition()

SpawnRuleConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::condition (std::unique_ptr< const helios::engine::runtime::spawn::policy::SpawnCondition > customCondition)
inline

Sets a custom spawn condition.

Parameters
customCondition

Ownership is transferred.

Returns

Reference to this config for chaining.

Definition at line 163 of file SpawnPoolConfig.ixx.

164 std::unique_ptr<const helios::engine::runtime::spawn::policy::SpawnCondition> customCondition
165 ) {
166 condition_ = std::move(customCondition);
167 return *this;
168 }

Reference SpawnRuleConfig.

done()

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

Finalizes the rule and returns to the parent profile config.

Returns

Reference to the parent SpawnProfileConfig.

Definition at line 215 of file SpawnPoolConfig.ixx.

624 return parent_;
625 }

fixedAmount()

SpawnRuleConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::fixedAmount (const size_t count)
inline

Sets a fixed spawn amount.

Parameters
count

Number of entities to spawn per trigger.

Returns

Reference to this config for chaining.

Definition at line 177 of file SpawnPoolConfig.ixx.

177 SpawnRuleConfig& fixedAmount(const size_t count) {
178 amountProvider_ = std::make_unique<
180 return *this;
181 }

Reference SpawnRuleConfig.

timerCondition()

SpawnRuleConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::timerCondition (const float intervalSeconds)
inline

Sets a timer-based spawn condition.

Parameters
intervalSeconds

Seconds between spawn evaluations.

Returns

Reference to this config for chaining.

Definition at line 133 of file SpawnPoolConfig.ixx.

133 SpawnRuleConfig& timerCondition(const float intervalSeconds) {
134 condition_ = std::make_unique<
136 intervalSeconds);
137 return *this;
138 }

Reference SpawnRuleConfig.

timerWithAvailabilityCondition()

SpawnRuleConfig & helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::timerWithAvailabilityCondition (const float intervalSeconds)
inline

Sets a combined condition: timer + pool availability.

Parameters
intervalSeconds

Seconds between spawn evaluations.

Returns

Reference to this config for chaining.

Definition at line 147 of file SpawnPoolConfig.ixx.

147 SpawnRuleConfig& timerWithAvailabilityCondition(const float intervalSeconds) {
148 condition_ = std::make_unique<
150 std::make_unique<helios::engine::runtime::spawn::policy::conditions::TimerSpawnCondition>(intervalSeconds),
151 std::make_unique<helios::engine::runtime::spawn::policy::conditions::RequestedAmountIsAvailableCondition>()
152 );
153 return *this;
154 }

Reference SpawnRuleConfig.

Private Member Attributes

amountProvider_

std::unique_ptr<const helios::engine::runtime::spawn::policy::amount::SpawnAmountProvider> helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::amountProvider_

Provider determining how many to spawn.

Definition at line 110 of file SpawnPoolConfig.ixx.

110 std::unique_ptr<const helios::engine::runtime::spawn::policy::amount::SpawnAmountProvider> amountProvider_;

condition_

std::unique_ptr<const helios::engine::runtime::spawn::policy::SpawnCondition> helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::condition_

Condition determining when to spawn.

Definition at line 105 of file SpawnPoolConfig.ixx.

105 std::unique_ptr<const helios::engine::runtime::spawn::policy::SpawnCondition> condition_;

parent_

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

Parent profile this rule belongs to.

Definition at line 95 of file SpawnPoolConfig.ixx.

95 SpawnProfileConfig& parent_;

ruleId_

helios::engine::runtime::spawn::types::SpawnRuleId helios::engine::builder::spawnSystem::builders::configs::SpawnRuleConfig::ruleId_

Unique identifier for this rule.

Definition at line 100 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.