Class Sequence

All Implemented Interfaces:
Goal, Behavior

public class Sequence extends Composite
Runs each Behavior in sequence.
  • Method Details

    • reset

      public void reset()
      Description copied from interface: Goal
      Resets the goal and any resources or state it is holding.
      Specified by:
      reset in interface Behavior
      Specified by:
      reset in interface Goal
      Overrides:
      reset in class Composite
    • retryChildren

      public boolean retryChildren()
    • run

      public BehaviorStatus run()
      Description copied from interface: Behavior
      Runs the behavior for one 'tick', optionally changing the state that it is in.
      Returns:
      The new state
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createRetryingSequence

      public static Sequence createRetryingSequence(Behavior... behaviors)
    • createRetryingSequence

      public static Sequence createRetryingSequence(Collection<Behavior> behaviors)
      Creates a retrying sequence that will continue from the current Behavior if it returns BehaviorStatus.FAILURE instead of propagating the failure up to its parent.
    • createSequence

      public static Sequence createSequence(Behavior... behaviors)
    • createSequence

      public static Sequence createSequence(Collection<Behavior> behaviors)
      Creates sequence that will stop executing if the current Behavior returns BehaviorStatus.FAILURE.