23 TreeNodeStatus
execute(const AIPtr& entity, int64_t deltaMillis)
override {
27 TreeNodeStatus result = FINISHED;
28 const int progress = std::max(0, getSelectorState(entity));
30 const std::size_t size = _children.size();
31 for (std::size_t i = static_cast<std::size_t>(progress); i < size; ++i) {
32 TreeNodePtr& child = _children[i];
34 result = child->execute(entity, deltaMillis);
36 if (result == RUNNING) {
37 setSelectorState(entity, static_cast<int>(i));
39 }
else if (result == CANNOTEXECUTE || result == FAILED) {
42 }
else if (result == EXCEPTION) {
47 if (result != RUNNING) {
51 return state(entity, result);
55 setSelectorState(entity, AI_NOTHING_SELECTED);
virtual TreeNodeStatus execute(const AIPtr &entity, int64_t deltaMillis)
Definition: TreeNodeImpl.h:184
Base class for all type of TreeNode selectors.
Definition: Selector.h:25
void resetState(const AIPtr &entity) override
Reset the states in the node and also in the entity.
Definition: Sequence.h:54
The sequence continues to execute their children until one of the children returned a state that is n...
Definition: Sequence.h:19
virtual void resetState(const AIPtr &entity)
Reset the states in the node and also in the entity.
Definition: TreeNodeImpl.h:55
TreeNodeStatus execute(const AIPtr &entity, int64_t deltaMillis) override
Definition: Sequence.h:23