35 Health(
int currentHealth,
int maxHealth)
Component representing entity health and invincibility.
float _timer
Invincibility duration timer in seconds.
bool takeDamage(int amount)
Apply damage to the entity. Respects invincibility frames - no damage taken if invincible.
int _max
Maximum health points.
int getCurrentHealth() const
Get current health points.
bool isInvincible() const
Check if entity is invincible.
int _current
Current health points.
void setInvincible(bool invincible)
Set invincibility state.
float getInvincibilityTimer() const
Get remaining invincibility time.
bool _invincible
Invincibility state.
ComponentType getType() const override
Get the component type ID.
void setInvincibilityTimer(float timer)
Set invincibility timer.
Health(int maxHealth)
Constructor with maximum health only. Sets current health equal to max health.
Health(int currentHealth, int maxHealth)
Constructor with current and maximum health.
~Health() override=default
void heal(int amount)
Restore health points. Cannot exceed maximum health.
void setCurrentHealth(int health)
Set current health.
int getMaxHealth() const
Get maximum health points.
void setMaxHealth(int health)
Set maximum health.
bool isDead() const
Check if entity is dead (health <= 0).
Base interface for all ECS components.
Maximum number of distinct component types supported by the Registry.
std::size_t ComponentType
Type alias for component identification.