BTParallel

Inherits: BTComposite < BTTask < BT

BT composite that executes all of its child tasks simultaneously.

Description

BTParallel executes all of its child tasks simultaneously. Note that BTParallel doesn’t involve multithreading. It processes each task sequentially, from first to last, in the same tick before returning a result. If one of the abort criterea is met, any tasks currently RUNNING will be terminated, and the result will be either FAILURE or SUCCESS. The num_failures_required determines when BTParallel fails and num_successes_required when it succeeds. When both are fullfilled, it gives priority to num_failures_required.

If set to repeat, all child tasks will be re-executed each tick, regardless of whether they previously resulted in SUCCESS or FAILURE.

Returns FAILURE when the required number of child tasks result in FAILURE. When repeat is set to false, if none of the criteria were met and all child tasks resulted in either SUCCESS or FAILURE, BTParallel will return FAILURE.

Returns SUCCESS when the required number of child tasks result in SUCCESS.

Returns RUNNING if none of the criterea were fulfilled, and either repeat is set to true or a child task resulted in RUNNING.

Properties

int

num_failures_required

1

int

num_successes_required

1

bool

repeat

false


Property Descriptions

int num_failures_required = 1

  • void set_num_failures_required ( int value )

  • int get_num_failures_required ( )

If the specified number of child tasks return SUCCESS, BTParallel will also return SUCCESS.


int num_successes_required = 1

  • void set_num_successes_required ( int value )

  • int get_num_successes_required ( )

If the specified number of child tasks return FAILURE, BTParallel will also return FAILURE.


bool repeat = false

  • void set_repeat ( bool value )

  • bool get_repeat ( )

When true, the child tasks will be executed again, regardless of whether they previously resulted in a SUCCESS or FAILURE.

When false, if none of the criteria were met, and all child tasks resulted in a SUCCESS or FAILURE, BTParallel will return FAILURE.