HealthComponent.ixx File
Component for tracking entity health. More...
Included Headers
#include <algorithm>
#include <cassert>
#include <helios.engine.mechanics.health.types>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | mechanics |
|
High-level gameplay systems and components for game logic. More... | |
| namespace | health |
|
Health management system for game entities. More... | |
| namespace | components |
|
Health-related ECS components. More... | |
Classes Index
| class | HealthComponent |
|
Component for tracking entity health and damage. More... | |
Description
Component for tracking entity health.
File Listing
The file content with the documentation metadata removed is:
15using namespace helios::engine::mechanics::health::types;
17export namespace helios::engine::mechanics::health::components {
26 class HealthComponent {
51 HealthDepletedBehavior healthDepletedBehavior_ = HealthDepletedBehavior::None;
83 HealthComponent() = default;
90 explicit HealthComponent(const float maxHealth) : maxHealth_(maxHealth) {};
97 HealthComponent(const HealthComponent& other)
106 HealthComponent& operator=(const HealthComponent&) = default;
107 HealthComponent(HealthComponent&&) noexcept = default;
108 HealthComponent& operator=(HealthComponent&&) noexcept = default;
115 void setHealthDepletedBehavior(const HealthDepletedBehavior behavior) noexcept {
124 [[nodiscard]] HealthDepletedBehavior healthDepletedBehavior() const noexcept {
135 void takeDamage(const float damage) noexcept {
136 health_ = std::max(0.0f, health_ - damage);
157 void setMaxHealth(const float maxHealth) noexcept {
158 maxHealth_ = maxHealth;
201 void clearDirty() noexcept {
220 reset();
229 reset();
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.