E - type of the blackboard object that tasks use to read or modify game statepublic abstract class SingleRunningChildBranch<E> extends BranchTask<E>
SingleRunningChildBranch task is a branch task that supports only one running child at a time.Task.Status| Modifier and Type | Field and Description |
|---|---|
protected int |
currentChildIndex
The index of the child currently processed.
|
protected Task<E>[] |
randomChildren
Array of random children.
|
children| Constructor and Description |
|---|
SingleRunningChildBranch()
Creates a
SingleRunningChildBranch task with no children |
SingleRunningChildBranch(Array<Task<E>> tasks)
Creates a
SingleRunningChildBranch task with a list of children |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cancelRunningChildren(int startIndex)
Terminates the running children of this task starting from the specified index up to the end.
|
void |
childFail(Task<E> task)
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> task)
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.
|
protected Task<E>[] |
createRandomChildren() |
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.
|
void |
start()
This method will be called once before this task's first run.
|
addChildToTask, getChild, getChildCountprotected int currentChildIndex
public SingleRunningChildBranch()
SingleRunningChildBranch task with no childrenpublic 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> task)
TaskchildSuccess in class Task<E>task - the task that succeededpublic void childFail(Task<E> task)
Taskpublic void run()
TaskTask.running(),
Task.success() or Task.fail() exactly once.public void start()
Taskprotected void cancelRunningChildren(int startIndex)
TaskcancelRunningChildren in class Task<E>startIndex - the start indexpublic void reset()
Taskprotected Task<E> copyTo(Task<E> task)
TaskcopyTo in class BranchTask<E>task - the task to be filledCopyright © 2018. All rights reserved.