14 if (path.
paces.empty())
return;
16 const bl::tmap::Direction moveDir = backwards ?
17 oppositeDirection(path.
paces[currentPace].direction) :
18 path.
paces[currentPace].direction;
24 if (currentStep == 0) {
25 if (currentPace == 0) { backwards =
false; }
28 currentStep = path.
paces[currentPace].steps - 1;
31 else { --currentStep; }
35 if (currentStep >= path.
paces[currentPace].steps) {
38 if (currentPace >= path.
paces.size()) {
41 currentPace = path.
paces.size() - 1;
42 currentStep = path.
paces.back().steps - 1;
44 else { currentPace = 0; }
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.
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)
Updates the entity along the path.
FixedPathBehavior(const file::Behavior::Path &path)
Construct a new Fixed Path Behavior component.
Contains data for when the behavior type is following a path.
std::vector< Pace > paces
The sections of the path.
bool reverse
True if the path should be done in reverse when completed, false to loop.