Setting up waypoints
By default, the enemy tanks will patrol the game arena. To implement this behavior, we need to specify first the patrolling path. We will explore path following thoroughly in Chapter 6, Path Following and Steering Behaviors. For now, we limit ourselves to a simple waypoints path.
To implement it, we put four Cube game objects at random places. They represent waypoints inside our scene, and therefore, we name each one WanderPoint
:
Here is what our WanderPoint objects look like:
Note that we need to tag these points with a tag called WanderPoint. Later, we will use this tag when we try to find the waypoints from our tank AI. As you can see in its properties, a waypoint is just a Cube game object with the Mesh Renderer checkbox disabled:
To show these points in the...