E - type of the blackboard object that tasks use to read or modify game state@TaskConstraint(minChildren=1, maxChildren=1) public abstract class Decorator<E> extends Task<E>
Decorator is a wrapper that provides custom behavior for its child. The child can be of any kind (branch task, leaf
task, or another decorator).Task.Status| Modifier and Type | Field and Description |
|---|---|
protected Task<E> |
child
The child task wrapped by this decorator
|
| Constructor and Description |
|---|
Decorator()
Creates a decorator with no child task.
|
Decorator(Task<E> child)
Creates a decorator that wraps the given task.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
addChildToTask(Task<E> child)
This method will add a child to the list of this task's 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
|
protected Task<E> |
copyTo(Task<E> task)
Copies this task to the given task.
|
Task<E> |
getChild(int i)
Returns the child at the given index.
|
int |
getChildCount()
Returns the number of children of this task.
|
void |
run()
This method contains the update logic of this task.
|
protected int addChildToTask(Task<E> child)
TaskaddChildToTask in class Task<E>child - the child task which will be addedpublic int getChildCount()
TaskgetChildCount in class Task<E>public Task<E> getChild(int i)
Taskpublic void run()
TaskTask.running(),
Task.success() or Task.fail() exactly once.public 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 void childFail(Task<E> runningTask)
Taskpublic void childSuccess(Task<E> runningTask)
TaskchildSuccess in class Task<E>runningTask - the task that succeededprotected Task<E> copyTo(Task<E> task)
TaskTask.cloneTask() only if Task.TASK_CLONER is
null which is its default value.Copyright © 2017. All rights reserved.