Peoplemon  0.1.0
Peoplemon 3 game source documentation
StandingBehavior.cpp
Go to the documentation of this file.
2 
3 namespace core
4 {
5 namespace component
6 {
7 StandingBehavior::StandingBehavior(bl::tmap::Direction faceDir)
8 : dir(faceDir) {}
9 
10 void StandingBehavior::update(bl::tmap::Position& position, Controllable& controller) {
11  if (position.direction != dir) { controller.processControl(input::fromDirection(dir)); }
12 }
13 
14 } // namespace component
15 } // namespace core
Core classes and functionality for both the editor and game.
EntityControl fromDirection(bl::tmap::Direction direction)
Helper method to convert a move direction to a control.
Definition: Control.cpp:36
Adding this component to an entity allows it to be controlled.
bool processControl(input::EntityControl command, bool sprint=false, bool overrideLock=false)
Processes the given command and manipulates the entity accordingly.
void update(bl::tmap::Position &position, Controllable &controller)
Ensures the managed entity is facing the required position.
StandingBehavior(bl::tmap::Direction faceDir)
Construct a new Standing Behavior component.