GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Health.hpp
Go to the documentation of this file.
1 #ifndef RADIX_COMPONENT_HEALTH_HPP
2 #define RADIX_COMPONENT_HEALTH_HPP
3 
5 
6 namespace radix {
7 
8 class Health : public Component {
9 public:
10  float maxHealth;
11  float health;
12 
13  Health(Entity &ent);
14 
15  const char* getName() const {
16  return "Health";
17  }
18 
19  TypeId getTypeId() const {
20  return Component::getTypeId<std::remove_reference<decltype(*this)>::type>();
21  }
22 
23  void serialize(serine::Archiver&);
24 
25  bool isAlive();
26  void heal(float amount);
27  void harm(float amount);
28  void kill();
29  void revive();
30 };
31 
32 } /* namespace radix */
33 
34 #endif /* RADIX_COMPONENT_HEALTH_HPP */
Definition: GameController.hpp:7
void kill()
Definition: Health.cpp:30
void revive()
Definition: Health.cpp:34
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
Base class to create entity components.
Definition: Component.hpp:25
float health
Definition: Health.hpp:11
void harm(float amount)
Definition: Health.cpp:26
ComponentTypeId TypeId
Definition: Component.hpp:35
float maxHealth
Definition: Health.hpp:10
bool isAlive()
Definition: Health.cpp:18
Health(Entity &ent)
Definition: Health.cpp:9
Definition: Health.hpp:8
const char * getName() const
Definition: Health.hpp:15
void serialize(serine::Archiver &)
Definition: Health.cpp:13
TypeId getTypeId() const
Definition: Health.hpp:19
void heal(float amount)
Definition: Health.cpp:22