Fix: sequence and selector working like dynamic

This commit is contained in:
Serhii Snitsaruk 2022-09-05 15:08:35 +02:00
parent 490a419f0e
commit 18746dc7c2
4 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ void BTRandomSelector::_enter() {
int BTRandomSelector::_tick(float p_delta) {
int status = FAILURE;
for (int i = 0; i < get_child_count(); i++) {
for (int i = last_running_idx; i < get_child_count(); i++) {
status = get_child(_indicies[i])->execute(p_delta);
if (status != FAILURE) {
last_running_idx = i;

View File

@ -15,7 +15,7 @@ void BTRandomSequence::_enter() {
int BTRandomSequence::_tick(float p_delta) {
int status = SUCCESS;
for (int i = 0; i < get_child_count(); i++) {
for (int i = last_running_idx; i < get_child_count(); i++) {
status = get_child(_indicies[i])->execute(p_delta);
if (status != SUCCESS) {
last_running_idx = i;

View File

@ -8,7 +8,7 @@ void BTSelector::_enter() {
int BTSelector::_tick(float p_delta) {
int status = FAILURE;
for (int i = 0; i < get_child_count(); i++) {
for (int i = last_running_idx; i < get_child_count(); i++) {
status = get_child(i)->execute(p_delta);
if (status != FAILURE) {
last_running_idx = i;

View File

@ -8,7 +8,7 @@ void BTSequence::_enter() {
int BTSequence::_tick(float p_delta) {
int status = SUCCESS;
for (int i = 0; i < get_child_count(); i++) {
for (int i = last_running_idx; i < get_child_count(); i++) {
status = get_child(i)->execute(p_delta);
if (status != SUCCESS) {
last_running_idx = i;