Thrive
timed_life_system.h
1 #pragma once
2 
3 #include "engine/component.h"
4 #include "engine/system.h"
5 #include "engine/touchable.h"
6 #include "scripting/luabind.h"
7 
8 
9 namespace luabind {
10 class scope;
11 }
12 
13 
14 namespace thrive {
15 
16 
20 class TimedLifeComponent : public Component {
21  COMPONENT(TimedLifeComponent)
22 
23 public:
24 
34  static luabind::scope
35  luaBindings();
36 
40  Milliseconds m_timeToLive = 0;
41 
42  void
43  load(
45  ) override;
46 
48  storage() const override;
49 
50 };
51 
52 
56 class TimedLifeSystem : public System {
57 
58 public:
59 
68  static luabind::scope
69  luaBindings();
70 
75 
80 
85  void init(GameState* gameState) override;
86 
90  void shutdown() override;
91 
95  void update(int, int) override;
96 
97 private:
98 
99  struct Implementation;
100  std::unique_ptr<Implementation> m_impl;
101 };
102 
103 }
104 
void init(GameState *gameState) override
Initializes the system.
Definition: timed_life_system.cpp:81
StorageContainer storage() const override
Serializes the component.
Definition: timed_life_system.cpp:43
Base class for components.
Definition: component.h:31
A system handles one specific part of the game.
Definition: system.h:23
void update(int, int) override
Updates the system.
Definition: timed_life_system.cpp:97
static luabind::scope luaBindings()
Lua bindings.
Definition: timed_life_system.cpp:18
void shutdown() override
Shuts the system down.
Definition: timed_life_system.cpp:90
void load(const StorageContainer &storage) override
Loads the component.
Definition: timed_life_system.cpp:34
Definition: bullet_to_ogre_system.h:5
Definition: bullet_ogre_conversion.h:6
~TimedLifeSystem()
Destructor.
Definition: timed_life_system.cpp:77
static luabind::scope luaBindings()
Lua bindings.
Definition: timed_life_system.cpp:55
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
TimedLifeSystem()
Constructor.
Definition: timed_life_system.cpp:71
Milliseconds m_timeToLive
The time until the owning entity despawns.
Definition: timed_life_system.h:40
Component for entities with timed life.
Definition: timed_life_system.h:20
Despawns entities after they've reached their lifetime.
Definition: timed_life_system.h:56
A key-value storage for serialization.
Definition: serialization.h:36