R-TYPE
Public Member Functions | List of all members
ECS::Health Class Reference

#include <Health.hpp>

Inheritance diagram for ECS::Health:
ECS::IComp

Public Member Functions

 Health (int life) noexcept
 
 Health (const Health &health) noexcept
 
 Health (Health &&) noexcept=delete
 
 ~Health () noexcept override=default
 
Healthoperator= (const Health &) const noexcept=delete
 
Healthoperator= (Health &&) const noexcept=delete
 
int getHealth () const noexcept
 
int getMaxHealth () const noexcept
 
void addHealth (int const healthToAdd) noexcept
 
void removeHealth (int const healthToRemove) noexcept
 
void setHealth (int const healthToSet) noexcept
 
- Public Member Functions inherited from ECS::IComp
virtual ~IComp () noexcept=default
 

Constructor & Destructor Documentation

◆ 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
lifeThe amount of health the entity will have.

◆ Health() [2/3]

ECS::Health::Health ( const Health health)
noexcept

Copy constructor for the Health class

Parameters
healthThe health to copy.

◆ Health() [3/3]

ECS::Health::Health ( Health &&  )
explicitdeletenoexcept

◆ ~Health()

ECS::Health::~Health ( )
overridedefaultnoexcept

Member Function Documentation

◆ 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
healthThe 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]

Health& ECS::Health::operator= ( const Health ) const
deletenoexcept

◆ operator=() [2/2]

Health& ECS::Health::operator= ( Health &&  ) const
deletenoexcept

◆ 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
healthThe 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
healthThe health of the entity.

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