E - type of the blackboard object that tasks use to read or modify game statepublic class Parallel<E> extends BranchTask<E>
Parallel is a special branch task that starts or resumes all children every single time. The actual behavior of
parallel task depends on its policy:
Parallel.Policy.Sequence: the parallel task fails as soon as one child fails; if all children succeed, then the parallel
task succeeds. This is the default policy.Parallel.Policy.Selector: the parallel task succeeds as soon as one child succeeds; if all children fail, then the parallel
task fails.| Modifier and Type | Class and Description |
|---|---|
static class |
Parallel.Policy
The enumeration of the policies supported by the
Parallel task. |
Task.Status| Modifier and Type | Field and Description |
|---|---|
Parallel.Policy |
policy
Optional task attribute specifying the parallel policy (defaults to
Parallel.Policy.Sequence) |
children| Constructor and Description |
|---|
Parallel()
Creates a parallel task with sequence policy and no children
|
Parallel(Array<Task<E>> tasks)
Creates a parallel task with sequence policy and the given children
|
Parallel(Parallel.Policy policy)
Creates a parallel task with the given policy and no children
|
Parallel(Parallel.Policy policy,
Array<Task<E>> tasks)
Creates a parallel task with the given policy and children
|
Parallel(Parallel.Policy policy,
Task<E>... tasks)
Creates a parallel task with the given policy and children
|
Parallel(Task<E>... tasks)
Creates a parallel task with sequence policy and the given children
|
| Modifier and Type | Method and Description |
|---|---|
void |
childFail(Task<E> runningTask)
This method will be called when one of the children of this task fails.
|
void |
childRunning(Task<E> task,
Task<E> reporter)
This method will be called when one of the ancestors of this task needs to run again.
|
void |
childSuccess(Task<E> runningTask)
This method will be called when one of the children of this task succeeds.
|
protected Task<E> |
copyTo(Task<E> task)
Copies this task to the given task.
|
void |
reset()
Resets this task to make it restart from scratch on next run.
|
void |
run()
This method contains the update logic of this task.
|
addChildToTask, getChild, getChildCountpublic Parallel.Policy policy
Parallel.Policy.Sequence)public Parallel()
public Parallel(Task<E>... tasks)
tasks - the childrenpublic Parallel(Array<Task<E>> tasks)
tasks - the childrenpublic Parallel(Parallel.Policy policy)
policy - the policypublic Parallel(Parallel.Policy policy, Task<E>... tasks)
policy - the policytasks - the childrenpublic Parallel(Parallel.Policy policy, Array<Task<E>> tasks)
policy - the policytasks - the childrenpublic void run()
TaskTask.running(),
Task.success() or Task.fail() exactly once.public void childRunning(Task<E> task, Task<E> reporter)
TaskchildRunning in class Task<E>task - the task that needs to run againreporter - the task that reports, usually one of this task's childrenpublic void childSuccess(Task<E> runningTask)
TaskchildSuccess in class Task<E>runningTask - the task that succeededpublic void childFail(Task<E> runningTask)
Taskpublic void reset()
TaskCopyright © 2018. All rights reserved.