E - type of the blackboard object that tasks use to read or modify game statepublic class DynamicGuardSelector<E> extends BranchTask<E>
DynamicGuardSelector is a branch task that executes the first child whose guard is evaluated to true. At
every AI cycle, the children's guards are re-evaluated, so if the guard of the running child is evaluated to false, it
is cancelled, and the child with the highest priority starts running. The DynamicGuardSelector task finishes when no
guard is evaluated to true (thus failing) or when its active child finishes (returning the active child's termination
status).Task.Status| Modifier and Type | Field and Description |
|---|---|
protected Task<E> |
runningChild
The child in the running status or
null if no child is running. |
children| Constructor and Description |
|---|
DynamicGuardSelector()
Creates a
DynamicGuardSelector branch with no children. |
DynamicGuardSelector(Array<Task<E>> tasks)
Creates a
DynamicGuardSelector branch with the given children. |
DynamicGuardSelector(Task<E>... tasks)
Creates a
DynamicGuardSelector branch with the given children. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 DynamicGuardSelector()
DynamicGuardSelector branch with no children.public DynamicGuardSelector(Task<E>... tasks)
DynamicGuardSelector branch with the given children.tasks - the children of this taskpublic 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 reset()
TaskCopyright © 2018. All rights reserved.