diff --git a/bt/composites/bt_random_selector.cpp b/bt/composites/bt_random_selector.cpp index e0891b8..b9ee1ae 100644 --- a/bt/composites/bt_random_selector.cpp +++ b/bt/composites/bt_random_selector.cpp @@ -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; diff --git a/bt/composites/bt_random_sequence.cpp b/bt/composites/bt_random_sequence.cpp index cecad21..d7a4072 100644 --- a/bt/composites/bt_random_sequence.cpp +++ b/bt/composites/bt_random_sequence.cpp @@ -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; diff --git a/bt/composites/bt_selector.cpp b/bt/composites/bt_selector.cpp index 99ae5ef..9f01540 100644 --- a/bt/composites/bt_selector.cpp +++ b/bt/composites/bt_selector.cpp @@ -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; diff --git a/bt/composites/bt_sequence.cpp b/bt/composites/bt_sequence.cpp index f174711..3b4b5e7 100644 --- a/bt/composites/bt_sequence.cpp +++ b/bt/composites/bt_sequence.cpp @@ -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;