Game Development Reference
In-Depth Information
Then, add two variables for the memory. The first is a Boolean called
donePatrolling , which will initially be false but will become true when the
5-second timer runs out, signaling the ship to return to the base. The second is
a GameObject variable that will store the navigation waypoint for the game base.
Create gameBase and set it to the game base GameObject.
Now that we have a memory set up, we can start modifying our behavior tree. We
already have part of the behavior tree set up that patrols the waypoint route. So, as
a next step, we will only let the ship continue to patrol if our donePatrolling Boolean
variableis false .Addaconstraintnodeabovethe waypointpatrol node.Therecall
constraint is the node that uses a logical expression and can evaluate success or
failure. Add the donePatrolling == false line to the constraint field in the Con-
straint node. The Constraint node will look like this:
Search WWH ::




Custom Search