E - type of the blackboard object that tasks use to read or modify game state@TaskConstraint(minChildren=0, maxChildren=0) public abstract class LeafTask<E> extends Task<E>
LeafTask is a terminal task of a behavior tree, contains action or condition logic, can not have any child.Task.Status| Constructor and Description |
|---|
LeafTask()
Creates a leaf task.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
addChildToTask(Task<E> child)
Always throws
IllegalStateException because a leaf task cannot have any children. |
void |
childFail(Task<E> runningTask)
This method will be called when one of the children of this task fails.
|
void |
childRunning(Task<E> runningTask,
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.
|
abstract Task.Status |
execute()
This method contains the update logic of this leaf task.
|
Task<E> |
getChild(int i) |
int |
getChildCount() |
void |
run()
This method contains the update logic of this task.
|
public abstract Task.Status execute()
Status#RUNNING
, Status#SUCCEEDED or Status#FAILED. Other return values will cause an IllegalStateException.public final void run()
execute() method.protected int addChildToTask(Task<E> child)
IllegalStateException because a leaf task cannot have any children.addChildToTask in class Task<E>child - the child task which will be addedpublic int getChildCount()
getChildCount in class Task<E>public final void childRunning(Task<E> runningTask, Task<E> reporter)
TaskchildRunning in class Task<E>runningTask - the task that needs to run againreporter - the task that reports, usually one of this task's childrenpublic final void childFail(Task<E> runningTask)
TaskCopyright © 2017. All rights reserved.