Skip to main content

HealthConfig.ixx File

Configuration for health components. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacebuilder

Fluent builder pattern for constructing GameObjects. More...

namespacegameObject

Factory and prototype classes for GameObject construction. More...

namespacebuilders

Domain-specific builders for configuring different aspects of GameObjects. More...

namespaceconfigs

Fine-grained configuration classes for component setup. More...

Classes Index

classHealthConfig

Fluent configuration for HealthComponent setup. More...

Description

Configuration for health components.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file HealthConfig.ixx
3 * @brief Configuration for health components.
4 */
5module;
6
7export module helios.engine.builder.gameObject.builders.configs.HealthConfig;
8
9import helios.engine.ecs.GameObject;
10
11import helios.engine.mechanics.health;
12import helios.engine.mechanics.match.components;
13
17
19
20
21 /**
22 * @brief Fluent configuration for HealthComponent setup.
23 *
24 * Automatically adds HealthComponent and provides methods for
25 * setting maximum health.
26 */
28
29 /**
30 * @brief Non-owning pointer to the target GameObject.
31 */
33
34 public:
35
36 /**
37 * @brief Constructs a HealthConfig and adds HealthComponent.
38 *
39 * @param gameObject Target GameObject to configure.
40 */
43 }
44
45 /**
46 * @brief Sets the maximum health value.
47 *
48 * @param maxHealth The maximum health value.
49 *
50 * @return Reference to this config for chaining.
51 */
53 gameObject_.getOrAdd<HealthComponent>()
54 .setMaxHealth(maxHealth);
55 gameObject_.getOrAdd<HealthComponent>()
56 .heal(maxHealth);
57
58 return *this;
59 }
60
61 /**
62 * @brief Sets the initial number of lives.
63 *
64 * Adds or retrieves a LivesComponent with the given count.
65 *
66 * @param lives Initial life count.
67 *
68 * @return Reference to this config for chaining.
69 */
70 HealthConfig& lives(const size_t lives) {
71 gameObject_.getOrAdd<LivesComponent>(lives);
72
73 return *this;
74 }
75
76
77
78 /**
79 * @brief Configures the response when health reaches zero.
80 *
81 * @param behavior Bitmask of HealthDepletedBehavior flags.
82 *
83 * @return Reference to this config for chaining.
84 */
86 gameObject_.getOrAdd<HealthComponent>()
87 .setHealthDepletedBehavior(behavior);
88
89 return *this;
90 }
91
92 };
93
94}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.