The Activate method simply turns on the wander steering behavior (see
Chapter 3 if you need a refresher) and sets the goal’s status to
//if status is inactive, call Activate() and set status to active
Goal_Wander::Process is just as straightforward. ActivateIfInactive is
called at the beginning of every goal’s
Process logic. If a goal’s status is
inactive (as it always will be the first time Process is called because
m_Status is set to inactive in the constructor), the Activate method is
called, thereby initializing the goal.
Terminate method switches the wander behavior off.
Now let’s examine a more complex atomic goal.
This directs a bot along a path edge and continuously monitors its progress
to ensure it doesn’t get stuck. To facilitate this, along with a local copy of
the path edge, it owns data members for recording the time the goal is acti
vated and the time the bot is expected to take to traverse the edge. It also
owns a Boolean data member to record whether the edge is the last in the
path. This value is needed to determine what steering behavior should be
used to traverse the edge (seek for normal path edges, arrive for the last).
Here’s its declaration:
class Goal_TraverseEdge : public Goal<Raven_Bot>
//the edge the bot will follow
//true if m_Edge is the last in the path.
//the estimated time the bot should take to traverse the edge
//this records the time this goal was activated
388 | Chapter 9
Examples of Goals Used by Raven Bots