Skip to main content

HealthConfig Class

Fluent configuration for HealthComponent setup. More...

Declaration

class helios::engine::builder::gameObject::builders::configs::HealthConfig { ... }

Public Constructors Index

HealthConfig (helios::engine::ecs::GameObject gameObject)

Constructs a HealthConfig and adds HealthComponent. More...

Public Member Functions Index

HealthConfig &maxHealth (const float maxHealth)

Sets the maximum health value. More...

HealthConfig &lives (const size_t lives)

Sets the initial number of lives. More...

HealthConfig &healthDepletedTriggers (const HealthDepletedBehavior behavior)

Configures the response when health reaches zero. More...

Private Member Attributes Index

helios::engine::ecs::GameObjectgameObject_

Non-owning pointer to the target GameObject. More...

Description

Fluent configuration for HealthComponent setup.

Automatically adds HealthComponent and provides methods for setting maximum health.

Definition at line 27 of file HealthConfig.ixx.

Public Constructors

HealthConfig()

helios::engine::builder::gameObject::builders::configs::HealthConfig::HealthConfig (helios::engine::ecs::GameObject gameObject)
inline explicit

Constructs a HealthConfig and adds HealthComponent.

Parameters
<a href="/docs/helios/namespaces/helios/engine/builder/gameobject">gameObject</a>

Target GameObject to configure.

Definition at line 41 of file HealthConfig.ixx.

Referenced by healthDepletedTriggers, lives and maxHealth.

Public Member Functions

healthDepletedTriggers()

HealthConfig & helios::engine::builder::gameObject::builders::configs::HealthConfig::healthDepletedTriggers (const HealthDepletedBehavior behavior)
inline

Configures the response when health reaches zero.

Parameters
behavior

Bitmask of HealthDepletedBehavior flags.

Returns

Reference to this config for chaining.

Definition at line 85 of file HealthConfig.ixx.

86 gameObject_.getOrAdd<HealthComponent>()
87 .setHealthDepletedBehavior(behavior);
88
89 return *this;
90 }

Reference HealthConfig.

lives()

HealthConfig & helios::engine::builder::gameObject::builders::configs::HealthConfig::lives (const size_t lives)
inline

Sets the initial number of lives.

Adds or retrieves a LivesComponent with the given count.

Parameters
lives

Initial life count.

Returns

Reference to this config for chaining.

Definition at line 70 of file HealthConfig.ixx.

70 HealthConfig& lives(const size_t lives) {
71 gameObject_.getOrAdd<LivesComponent>(lives);
72
73 return *this;
74 }

References HealthConfig and lives.

Referenced by lives.

maxHealth()

HealthConfig & helios::engine::builder::gameObject::builders::configs::HealthConfig::maxHealth (const float maxHealth)
inline

Sets the maximum health value.

Parameters
maxHealth

The maximum health value.

Returns

Reference to this config for chaining.

Definition at line 52 of file HealthConfig.ixx.

53 gameObject_.getOrAdd<HealthComponent>()
54 .setMaxHealth(maxHealth);
55 gameObject_.getOrAdd<HealthComponent>()
56 .heal(maxHealth);
57
58 return *this;
59 }

References HealthConfig and maxHealth.

Referenced by maxHealth.

Private Member Attributes

gameObject_

helios::engine::ecs::GameObject helios::engine::builder::gameObject::builders::configs::HealthConfig::gameObject_

Non-owning pointer to the target GameObject.

Definition at line 32 of file HealthConfig.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.