Skip to main content

SpawnRuleState Class

Runtime state for a spawn rule. More...

Declaration

class helios::engine::runtime::spawn::policy::SpawnRuleState { ... }

Public Member Functions Index

voidsetSinceLastSpawn (float sinceLastSpawn) noexcept

Sets the time since last spawn. More...

floatsinceLastSpawn () const noexcept

Returns the time since last spawn. More...

voidupdate (const float deltaTime) noexcept

Updates the state with the frame delta time. More...

Private Member Attributes Index

floatsinceLastSpawn_ = 0.0f

Time elapsed since the last spawn in seconds. More...

Description

Runtime state for a spawn rule.

SpawnRuleState tracks the runtime state associated with a SpawnRule, such as time since last spawn. This state is updated each frame and used by SpawnCondition to determine if spawning should occur.

See Also

SpawnRule

See Also

SpawnCondition

Definition at line 21 of file SpawnRuleState.ixx.

Public Member Functions

setSinceLastSpawn()

void helios::engine::runtime::spawn::policy::SpawnRuleState::setSinceLastSpawn (float sinceLastSpawn)
inline noexcept

Sets the time since last spawn.

Parameters
sinceLastSpawn

Time in seconds.

Definition at line 35 of file SpawnRuleState.ixx.

35 void setSinceLastSpawn(float sinceLastSpawn) noexcept {
36 sinceLastSpawn_ = sinceLastSpawn;
37 }

Reference sinceLastSpawn.

Referenced by helios::engine::runtime::spawn::policy::conditions::RequestedAmountIsAvailableCondition::onCommit and helios::engine::runtime::spawn::policy::conditions::TimerSpawnCondition::onCommit.

sinceLastSpawn()

float helios::engine::runtime::spawn::policy::SpawnRuleState::sinceLastSpawn ()
inline nodiscard noexcept

Returns the time since last spawn.

Returns

Time in seconds since the last spawn.

Definition at line 44 of file SpawnRuleState.ixx.

44 [[nodiscard]] float sinceLastSpawn() const noexcept {
45 return sinceLastSpawn_;
46 }

Referenced by setSinceLastSpawn.

update()

void helios::engine::runtime::spawn::policy::SpawnRuleState::update (const float deltaTime)
inline noexcept

Updates the state with the frame delta time.

Parameters
deltaTime

Time elapsed since last frame in seconds.

Definition at line 53 of file SpawnRuleState.ixx.

53 void update(const float deltaTime) noexcept {
54 sinceLastSpawn_ += deltaTime;
55 }

Private Member Attributes

sinceLastSpawn_

float helios::engine::runtime::spawn::policy::SpawnRuleState::sinceLastSpawn_ = 0.0f

Time elapsed since the last spawn in seconds.

Definition at line 26 of file SpawnRuleState.ixx.

26 float sinceLastSpawn_ = 0.0f;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.