Game Development Reference
In-Depth Information
The Update function calls the RunBehaviors function. This is what will keep the
AI running; it will run the correct behavior as long as the AI is active.
Filling out the inspector
To complete the AI package, we will need to add the script to the skeleton, so drag
the script onto the skeleton in the Hierarchy window. In the Size property of the way-
points array, type the number 5 and open up the drop-down list. Starting with Ele-
ment 0 , drag each of the waypoints into the empty slots.
For the projectile, create a sphere GameObject and make it a prefab. Now, drag it
onto the empty slot next to Projectile . Finally, set the AI Behaviors to Guard . This
will make it so that when you start the scene, your AI will be patrolling. The Inspect-
or window of the skeleton should look something like this:
Search WWH ::




Custom Search