#include <Health.hpp>
◆ Health() [1/3]
ECS::Health::Health |
( |
int |
life | ) |
|
|
explicitnoexcept |
This function is a constructor for the Health component. It takes in an integer and sets the max health and current health to that value.
- Parameters
-
life | The amount of health the entity will have. |
◆ Health() [2/3]
ECS::Health::Health |
( |
const Health & |
health | ) |
|
|
noexcept |
Copy constructor for the Health class
- Parameters
-
health | The health to copy. |
◆ Health() [3/3]
ECS::Health::Health |
( |
Health && |
| ) |
|
|
explicitdeletenoexcept |
◆ ~Health()
◆ addHealth()
void ECS::Health::addHealth |
( |
int const |
healthToAdd | ) |
|
|
noexcept |
If the health is greater than the max health, set the health to the max health, otherwise add the health
- Parameters
-
health | The current health of the entity. |
◆ getHealth()
int ECS::Health::getHealth |
( |
| ) |
const |
|
noexcept |
This function returns the value of the private member variable _health.
- Returns
- The health of the entity.
◆ getMaxHealth()
int ECS::Health::getMaxHealth |
( |
| ) |
const |
|
noexcept |
This function returns the maximum health of the entity.
- Returns
- The max health of the entity.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ removeHealth()
void ECS::Health::removeHealth |
( |
int const |
healthToRemove | ) |
|
|
noexcept |
If the health is less than 0, set it to 0, otherwise subtract the health
- Parameters
-
health | The amount of health to add to the entity. |
◆ setHealth()
void ECS::Health::setHealth |
( |
int const |
healthToSet | ) |
|
|
noexcept |
This function sets the health of the entity.
- Parameters
-
health | The health of the entity. |
The documentation for this class was generated from the following files: