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
PlayerTask.hpp
Go to the documentation of this file.
1 #ifndef RADIX_PLAYERTASK_HPP
2 #define RADIX_PLAYERTASK_HPP
3 
4 #include <functional>
5 #include <string>
6 #include <list>
7 
8 #include <radix/BaseGame.hpp>
9 
10 
11 namespace radix {
12 
13 class PlayerTask {
14 public:
15  using Task = std::function<void(BaseGame *game, TDelta dtime)>;
16 
17  PlayerTask() {};
18  virtual ~PlayerTask() {};
19 
20  int id;
22  std::list<PlayerTask *> blackList;
23 
24  template<typename T>
25  inline void addBlacklist() {
26  static_assert(std::is_base_of<PlayerTask, T>::value, "T must be a PlayerTask");
27  T *result = new T;
28  blackList.push_back(result);
29  }
30 
31  virtual std::string getName() = 0;
32 };
33 
34 class PlayerTriggerTask : public PlayerTask {
35 public:
37  std::string getName();
38 };
39 
40 class PlayerMoveTask : public PlayerTask {
41 public:
43  std::string getName();
44 };
45 
46 } /* namespace radix */
47 #endif /* RADIX_PLAYERTASK_HPP */
virtual ~PlayerTask()
Definition: PlayerTask.hpp:18
Definition: GameController.hpp:7
PlayerTask()
Definition: PlayerTask.hpp:17
Definition: PlayerTask.hpp:40
std::list< PlayerTask * > blackList
Definition: PlayerTask.hpp:22
Task task
Definition: PlayerTask.hpp:21
std::string getName()
Definition: PlayerTask.cpp:16
Definition: PlayerTask.hpp:13
PlayerMoveTask()
Definition: PlayerTask.cpp:20
std::function< void(BaseGame *game, TDelta dtime)> Task
Definition: PlayerTask.hpp:15
void addBlacklist()
Definition: PlayerTask.hpp:25
virtual std::string getName()=0
Definition: PlayerTask.hpp:34
int id
Definition: PlayerTask.hpp:18
PlayerTriggerTask()
Definition: PlayerTask.cpp:9
std::string getName()
Definition: PlayerTask.cpp:86