SpawnConditionAll Class
Composite condition requiring all child conditions to pass. More...
Declaration
Base class
| class | SpawnCondition |
|
Abstract interface for determining when spawning should occur. More... | |
Public Constructors Index
template <typename... Args> | |
| SpawnConditionAll (Args &&... args) | |
|
Constructs a composite condition from variadic arguments. More... | |
Public Member Functions Index
| bool | isSatisfied (const size_t requestedAmount, const SpawnRuleState &spawnState, const helios::engine::runtime::pooling::GameObjectPoolSnapshot poolSnapshot, const helios::engine::runtime::world::UpdateContext &updateContext) const noexcept override |
|
Checks if all child conditions are satisfied. More... | |
| void | onCommit (SpawnRuleState &spawnRuleState, const size_t spawnAmount) const override |
|
Propagates commit to all child conditions. More... | |
| void | onReset (SpawnRuleState &spawnRuleState) const noexcept override |
|
Propagates reset to all child conditions. More... | |
Private Member Attributes Index
| std::vector< std::unique_ptr< helios::engine::runtime::spawn::policy::SpawnCondition > > | spawnConditions_ |
|
Collection of child conditions to evaluate. More... | |
Description
Composite condition requiring all child conditions to pass.
SpawnConditionAll implements a logical AND over multiple SpawnCondition instances. The spawn is permitted only when every child condition returns `true` from `isSatisfied()`.
## Behavior
- Short-circuits on first failing condition
- Propagates `onCommit()` to all child conditions
- Accepts variadic condition arguments via constructor
## Usage
```cpp auto condition = std::make_unique<SpawnConditionAll>( std::make_unique<TimerCondition>(2.0f), std::make_unique<RequestedAmountIsAvailableCondition>(), std::make_unique<MaxActiveCondition>(10) );
// Spawns only when: timer elapsed AND pool available AND under max ```
- See Also
- See Also
TimerCondition
- See Also
RequestedAmountIsAvailableCondition
Definition at line 51 of file SpawnConditionAll.ixx.
Public Constructors
SpawnConditionAll()
| inline explicit |
Constructs a composite condition from variadic arguments.
- Template Parameters
-
Args Types of spawn conditions (must be unique_ptr<SpawnCondition>).
- Parameters
-
args Spawn conditions to combine. Ownership transferred.
Definition at line 68 of file SpawnConditionAll.ixx.
Public Member Functions
isSatisfied()
| inline nodiscard noexcept virtual |
Checks if all child conditions are satisfied.
Iterates through all conditions and returns `false` on the first condition that fails (short-circuit evaluation).
- Parameters
-
requestedAmount Number of entities requested for spawn.
spawnState Current state of the spawn rule.
poolSnapshot Snapshot of the entity pool.
updateContext Current frame context.
- Returns
`true` if all conditions pass, `false` otherwise.
Definition at line 89 of file SpawnConditionAll.ixx.
onCommit()
| inline virtual |
Propagates commit to all child conditions.
Calls `onCommit()` on each child condition to allow them to update their internal state after a successful spawn.
- Parameters
-
spawnRuleState The rule's runtime state to update.
spawnAmount The number of entities that were spawned.
Definition at line 116 of file SpawnConditionAll.ixx.
onReset()
| inline noexcept virtual |
Propagates reset to all child conditions.
- Parameters
-
spawnRuleState The rule's runtime state to reset.
Definition at line 131 of file SpawnConditionAll.ixx.
Private Member Attributes
spawnConditions_
|
Collection of child conditions to evaluate.
Definition at line 56 of file SpawnConditionAll.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.