Class AbstractGoal<O extends Agent>

    • Constructor Detail

      • AbstractGoal

        protected AbstractGoal​(GoalType type)
        Creates a new AbstractGoal with the provided Goal.
        Parameters:
        type - The type
    • Method Detail

      • type

        public final GoalType type()
        Description copied from interface: Goal
        Gets the GoalType.
        Specified by:
        type in interface Goal<O extends Agent>
        Returns:
        The type
      • start

        public abstract void start()
        Invoked when the goal is "started". A "start" of a goal occurs at the "start" of the "AI" is "ticking". Depending on the case where shouldUpdate() returns false, an Goal is NOT going to be called, so this method would not be called at the "start" of the tick to "prepare" for update().
      • shouldUpdate

        public abstract boolean shouldUpdate()
        Determines whether this Goal should be considered for "ticking" or start(), update(), and reset() are called for that "AI" tick.
        Returns:
        Whether this goal should be marked for use in the current tick
      • update

        public abstract void update()
        Performs any customary logic for this goal to modify the parent Agent in any way, including navigation, health, potion effects, etc. Only called when shouldUpdate() returns true, and after start() has completed. Likewise, if continueUpdating()
      • continueUpdating

        public abstract boolean continueUpdating()
        Called to verify that this Goal needs to update() in this tick. If this returns false, this goal is removed from use and reset() is called.
        Returns:
        Whether this task should update this "tick" or not
      • reset

        public abstract void reset()
        Performs any reset necessary for this goal during the current tick.

        Note that this may be called during any state during start() or update() such that the goal is removed from use for the current "AI" tick.