Fix: sequence and selector working like dynamic
This commit is contained in:
parent
490a419f0e
commit
18746dc7c2
|
@ -15,7 +15,7 @@ void BTRandomSelector::_enter() {
|
||||||
|
|
||||||
int BTRandomSelector::_tick(float p_delta) {
|
int BTRandomSelector::_tick(float p_delta) {
|
||||||
int status = FAILURE;
|
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);
|
status = get_child(_indicies[i])->execute(p_delta);
|
||||||
if (status != FAILURE) {
|
if (status != FAILURE) {
|
||||||
last_running_idx = i;
|
last_running_idx = i;
|
||||||
|
|
|
@ -15,7 +15,7 @@ void BTRandomSequence::_enter() {
|
||||||
|
|
||||||
int BTRandomSequence::_tick(float p_delta) {
|
int BTRandomSequence::_tick(float p_delta) {
|
||||||
int status = SUCCESS;
|
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);
|
status = get_child(_indicies[i])->execute(p_delta);
|
||||||
if (status != SUCCESS) {
|
if (status != SUCCESS) {
|
||||||
last_running_idx = i;
|
last_running_idx = i;
|
||||||
|
|
|
@ -8,7 +8,7 @@ void BTSelector::_enter() {
|
||||||
|
|
||||||
int BTSelector::_tick(float p_delta) {
|
int BTSelector::_tick(float p_delta) {
|
||||||
int status = FAILURE;
|
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);
|
status = get_child(i)->execute(p_delta);
|
||||||
if (status != FAILURE) {
|
if (status != FAILURE) {
|
||||||
last_running_idx = i;
|
last_running_idx = i;
|
||||||
|
|
|
@ -8,7 +8,7 @@ void BTSequence::_enter() {
|
||||||
|
|
||||||
int BTSequence::_tick(float p_delta) {
|
int BTSequence::_tick(float p_delta) {
|
||||||
int status = SUCCESS;
|
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);
|
status = get_child(i)->execute(p_delta);
|
||||||
if (status != SUCCESS) {
|
if (status != SUCCESS) {
|
||||||
last_running_idx = i;
|
last_running_idx = i;
|
||||||
|
|
Loading…
Reference in New Issue