Class WanderGoal

All Implemented Interfaces:
Goal, Behavior, Listener

public class WanderGoal extends BehaviorGoalAdapter implements Listener
A sample Goal/Behavior that will wander within a certain radius or QuadTree.
  • Method Details

    • onFinish

      public void onFinish(NavigationCompleteEvent event)
    • pause

      public void pause()
    • 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
    • run

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

      public void setDelay(int delay)
    • setWorldGuardRegion

      public void setWorldGuardRegion(Object region)
    • setXYRange

      public void setXYRange(int xrange, int yrange)
    • shouldExecute

      public boolean shouldExecute()
      Description copied from interface: Behavior
      Returns whether the behavior is ready to run. Note this is called once when deciding whether to start execution of a leaf node. The actual execution status is determined by the return value of which is repeatedly called by the executing node.
      Specified by:
      shouldExecute in interface Behavior
    • unpause

      public void unpause()
    • createWithNPC

      public static WanderGoal createWithNPC(NPC npc)
    • createWithNPCAndRange

      public static WanderGoal createWithNPCAndRange(NPC npc, int xrange, int yrange)
    • createWithNPCAndRangeAndTree

      public static WanderGoal createWithNPCAndRangeAndTree(NPC npc, int xrange, int yrange,<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree)
    • createWithNPCAndRangeAndTreeAndFallback

      public static WanderGoal createWithNPCAndRangeAndTreeAndFallback(NPC npc, int xrange, int yrange,<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree,<NPC,Location> fallback)
    • createWithNPCAndRangeAndTreeAndFallbackAndRegion

      public static WanderGoal createWithNPCAndRangeAndTreeAndFallbackAndRegion(NPC npc, int xrange, int yrange,<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree,<NPC,Location> fallback, Object worldguardRegion)
      The full builder method.
      npc - the NPC to wander
      xrange - x/z range, in blocks
      yrange - y range, in blocks
      tree - an optional PhTreeSolid supplier to allow only wandering within a certain PhTreeSolid
      fallback - an optional fallback location
      worldguardRegion - the optional region
      the built goal