E - type of the blackboard object that tasks use to read or modify game statepublic class Repeat<E> extends LoopDecorator<E>
Repeat decorator will repeat the wrapped task a certain number of times, possibly infinite. This task always succeeds
when reaches the specified number of repetitions.Task.Status| Modifier and Type | Field and Description |
|---|---|
IntegerDistribution |
times
Optional task attribute specifying the integer distribution that determines how many times the wrapped task must be
repeated.
|
loop| Constructor and Description |
|---|
Repeat()
Creates an infinite repeat decorator with no child task.
|
Repeat(IntegerDistribution times,
Task<E> child)
Creates a repeat decorator that executes the given task the number of times (possibly infinite) determined by the given
distribution.
|
Repeat(Task<E> child)
Creates an infinite repeat decorator that wraps the given task.
|
| 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 |
childSuccess(Task<E> runningTask)
This method will be called when one of the children of this task succeeds
|
boolean |
condition()
Whether the
LoopDecorator.run() method must keep looping or not. |
protected Task<E> |
copyTo(Task<E> task)
Copies this task to the given task.
|
void |
start()
Draws a value from the distribution that determines how many times the wrapped task must be repeated.
|
childRunning, runaddChildToTask, getChild, getChildCountpublic IntegerDistribution times
ConstantIntegerDistribution.NEGATIVE_ONE which indicates an infinite number of repetitions.start()public Repeat()
public Repeat(Task<E> child)
child - the task that will be wrappedpublic Repeat(IntegerDistribution times, Task<E> child)
start() method. Any negative value means
forever.times - the integer distribution specifying how many times the child must be repeated.child - the task that will be wrappedpublic void start()
This method is called when the task is entered.
public boolean condition()
LoopDecoratorLoopDecorator.run() method must keep looping or not.condition in class LoopDecorator<E>true if it must keep looping; false otherwise.public void childSuccess(Task<E> runningTask)
TaskchildSuccess in class Decorator<E>runningTask - the task that succeededpublic void childFail(Task<E> runningTask)
Taskprotected 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.