21 TreeNodeStatus
execute(const AIPtr& entity, int64_t deltaMillis)
override {
22 if (_children.size() != 1) {
23 ai_assert(
false,
"Invert must have exactly one child");
30 const TreeNodePtr& treeNode = *_children.begin();
31 const TreeNodeStatus status = treeNode->execute(entity, deltaMillis);
32 if (status == FINISHED) {
33 return state(entity, FAILED);
34 }
else if (status == FAILED) {
35 return state(entity, FINISHED);
36 }
else if (status == EXCEPTION) {
37 return state(entity, EXCEPTION);
38 }
else if (status == CANNOTEXECUTE) {
39 return state(entity, FINISHED);
41 return state(entity, RUNNING);
#define ai_assert(condition,...)
Provide your own assert - this is only executed in DEBUG mode.
Definition: Types.h:75
A node with only one child attached. The result of the attached child is inverted.
Definition: Invert.h:17
virtual TreeNodeStatus execute(const AIPtr &entity, int64_t deltaMillis)
Definition: TreeNodeImpl.h:184
TreeNodeStatus execute(const AIPtr &entity, int64_t deltaMillis) override
Definition: Invert.h:21
The base class for all behaviour tree actions.
Definition: TreeNode.h:88
#define NODE_CLASS(NodeName)
A node class macro that also defines a factory.
Definition: TreeNode.h:69