Fix BTState not honoring API virtual methods
This commit is contained in:
parent
c96e2019af
commit
f5d21e2669
|
@ -46,6 +46,7 @@ void BTState::_update_blackboard_plan() {
|
|||
}
|
||||
|
||||
void BTState::_setup() {
|
||||
LimboState::_setup();
|
||||
ERR_FAIL_COND_MSG(behavior_tree.is_null(), "BTState: BehaviorTree is not assigned.");
|
||||
tree_instance = behavior_tree->instantiate(get_agent(), get_blackboard());
|
||||
|
||||
|
@ -57,19 +58,21 @@ void BTState::_setup() {
|
|||
}
|
||||
|
||||
void BTState::_exit() {
|
||||
ERR_FAIL_COND(tree_instance == nullptr);
|
||||
LimboState::_exit();
|
||||
ERR_FAIL_NULL(tree_instance);
|
||||
tree_instance->abort();
|
||||
}
|
||||
|
||||
void BTState::_update(double p_delta) {
|
||||
ERR_FAIL_COND(tree_instance == nullptr);
|
||||
VCALL_ARGS(_update, p_delta);
|
||||
ERR_FAIL_NULL(tree_instance);
|
||||
int status = tree_instance->execute(p_delta);
|
||||
emit_signal(LimboStringNames::get_singleton()->updated, p_delta);
|
||||
if (status == BTTask::SUCCESS) {
|
||||
get_root()->dispatch(success_event, Variant());
|
||||
} else if (status == BTTask::FAILURE) {
|
||||
get_root()->dispatch(failure_event, Variant());
|
||||
}
|
||||
emit_signal(LW_NAME(updated), p_delta);
|
||||
}
|
||||
|
||||
void BTState::_notification(int p_notification) {
|
||||
|
|
Loading…
Reference in New Issue