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
PlayerSystem.hpp
Go to the documentation of this file.
1 #ifndef RADIX_PLAYER_SYSTEM_HPP
2 #define RADIX_PLAYER_SYSTEM_HPP
3 
4 #include <random>
5 #include <unordered_set>
6 
8 #include <radix/PlayerTask.hpp>
9 
10 namespace radix {
11 
12 class Entity;
13 
14 static const float RUNNING_SPEED = 0.1f;
15 static const float JUMP_SPEED = 0.15f;
16 static const float HURT_VELOCITY = 0.18f;
17 
18 static const std::array<const std::string, 2> PLAYER_PANTING_SOUND = {
19  "/audio/sfx/character/fem_panting_1.ogg",
20  "/audio/sfx/character/fem_panting_2.ogg"
21 };
22 
23 static const std::array<const std::string, 2> PLAYER_JUMP_SOUND = {
24  "/audio/sfx/character/fem_jump_1.ogg",
25  "/audio/sfx/character/fem_jump_2.ogg"
26 };
27 
28 static const std::array<const std::string, 2> PLAYER_FALL_SOUND = {
29  "/audio/sfx/character/fem_fall_1.ogg",
30  "/audio/sfx/character/fem_fall_2.ogg"
31 };
32 
33 static const std::array<const std::string, 6> PLAYER_FOOT_SOUND = {
34  "/audio/sfx/character/fem_foot_1.ogg",
35  "/audio/sfx/character/fem_foot_2.ogg",
36  "/audio/sfx/character/fem_foot_3.ogg",
37  "/audio/sfx/character/fem_foot_4.ogg",
38  "/audio/sfx/character/fem_foot_5.ogg",
39  "/audio/sfx/character/fem_foot_6.ogg"
40 };
41 
42 class PlayerSystem : public System {
43 protected:
44  void mouseLook(Entity &entity);
45  void runTasks(Entity &entity, TDelta dtime);
46  bool allowedToRun(std::unordered_set<PlayerTask*> &blackList, PlayerTask *task);
47 
49 public:
51  ~PlayerSystem();
52 
53  const char* getName() const {
54  return "PlayerSystem";
55  }
56 
57  TypeId getTypeId() const {
58  return System::getTypeId<std::remove_reference<decltype(*this)>::type>();
59  }
60 
61  bool runsBefore(const System&);
62  void update(TDelta dtime);
63 };
64 
65 } /* namespace radix */
66 
67 #endif /* RADIX_PLAYER_SYSTEM_HPP */
Definition: GameController.hpp:7
TypeId getTypeId() const
Definition: PlayerSystem.hpp:57
Definition: System.hpp:21
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
static const float RUNNING_SPEED
Definition: PlayerSystem.hpp:14
~PlayerSystem()
Definition: PlayerSystem.cpp:14
bool runsBefore(const System &)
Definition: PlayerSystem.cpp:72
static const float JUMP_SPEED
Definition: PlayerSystem.hpp:15
void mouseLook(Entity &entity)
Definition: PlayerSystem.cpp:17
Definition: PlayerSystem.hpp:42
Definition: TimeDelta.hpp:8
static const std::array< const std::string, 2 > PLAYER_FALL_SOUND
Definition: PlayerSystem.hpp:28
void runTasks(Entity &entity, TDelta dtime)
Definition: PlayerSystem.cpp:40
static const float HURT_VELOCITY
Definition: PlayerSystem.hpp:16
BaseGame * game
Definition: PlayerSystem.hpp:48
static const std::array< const std::string, 2 > PLAYER_JUMP_SOUND
Definition: PlayerSystem.hpp:23
Definition: PlayerTask.hpp:13
bool allowedToRun(std::unordered_set< PlayerTask * > &blackList, PlayerTask *task)
Definition: PlayerSystem.cpp:59
static const std::array< const std::string, 2 > PLAYER_PANTING_SOUND
Definition: PlayerSystem.hpp:18
PlayerSystem(World &, BaseGame *)
Definition: PlayerSystem.cpp:10
SystemTypeId TypeId
Definition: System.hpp:26
static const std::array< const std::string, 6 > PLAYER_FOOT_SOUND
Definition: PlayerSystem.hpp:33
void update(TDelta dtime)
Definition: PlayerSystem.cpp:76
Definition: World.hpp:32
Definition: BaseGame.hpp:22
const char * getName() const
Definition: PlayerSystem.hpp:53