Peoplemon  0.1.0
Peoplemon 3 game source documentation
Controllable.hpp
Go to the documentation of this file.
1 #ifndef CORE_COMPONENTS_CONTROLLABLE_HPP
2 #define CORE_COMPONENTS_CONTROLLABLE_HPP
3 
5 #include <Core/Input/Control.hpp>
6 
7 namespace core
8 {
9 namespace system
10 {
11 class Systems;
12 }
13 
14 namespace component
15 {
22 class Controllable {
23 public:
30  Controllable(system::Systems& systems, bl::ecs::Entity owner);
31 
40  bool processControl(input::EntityControl command, bool sprint = false,
41  bool overrideLock = false);
42 
50  void setLocked(bool lock, bool preserve = true);
51 
56  void resetLock();
57 
62  bool isLocked() const;
63 
64 private:
65  bl::ecs::Entity owner;
66  system::Systems& systems;
67  bool locked;
68  bool wasLocked;
69 };
70 
71 } // namespace component
72 } // namespace core
73 
74 #endif
Core classes and functionality for both the editor and game.
std::underlying_type_t< Control::EntityControl > EntityControl
Helper typedef to avoid too much casting boilerplate.
Definition: Control.hpp:44
Adding this component to an entity allows it to be controlled.
void setLocked(bool lock, bool preserve=true)
Locks the controllable and prevents any commands from being processed. Optionally remembers the previ...
void resetLock()
Resets the lock state back to the last preserved state.
bool processControl(input::EntityControl command, bool sprint=false, bool overrideLock=false)
Processes the given command and manipulates the entity accordingly.
bool isLocked() const
Returns whether or not this component is locked.
Controllable(system::Systems &systems, bl::ecs::Entity owner)
Construct a new Controllable component.
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47