Merge commit 'd2b91de4d6' into development
This commit is contained in:
commit
03d94552d7
3 changed files with 8 additions and 8 deletions
|
|
@ -9,11 +9,13 @@ void BehaviourAction::_bind_methods() {
|
|||
}
|
||||
|
||||
void BehaviourAction::enter() {
|
||||
GDVIRTUAL_CALL(_enter);
|
||||
Status out_status{ get_status() };
|
||||
GDVIRTUAL_CALL(_enter, out_status);
|
||||
set_status(out_status);
|
||||
}
|
||||
|
||||
void BehaviourAction::execute() {
|
||||
Status out_status{ Fail };
|
||||
Status out_status{ get_status() };
|
||||
GDVIRTUAL_CALL(_execute, out_status);
|
||||
set_status(out_status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public:
|
|||
void execute() override;
|
||||
void exit() override;
|
||||
BehaviourNode *get_next() override;
|
||||
GDVIRTUAL0R_REQUIRED(Status, _execute);
|
||||
GDVIRTUAL0(_enter);
|
||||
GDVIRTUAL0R(Status, _execute);
|
||||
GDVIRTUAL0R(Status, _enter);
|
||||
GDVIRTUAL0(_exit);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@
|
|||
void BehaviourTree::_bind_methods() {}
|
||||
|
||||
void BehaviourTree::process() {
|
||||
this->current->execute();
|
||||
while (execute_next()) {
|
||||
do {
|
||||
this->current->execute();
|
||||
}
|
||||
} while (execute_next());
|
||||
}
|
||||
|
||||
void BehaviourTree::_notification(int what) {
|
||||
|
|
@ -46,7 +45,6 @@ bool BehaviourTree::execute_next() {
|
|||
}
|
||||
if (this->current->get_parent() != next) {
|
||||
next->enter();
|
||||
next->execute();
|
||||
}
|
||||
this->current = next;
|
||||
return cast_to<BehaviourComposite>(this->current) || this->current->get_status() == BehaviourNode::Fail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue