Testing

Now, play the game in Unity3D and move the player tank near the wandering AI character by clicking on the ground. You should see the message Enemy touch detected in the console log window whenever our AI character gets close to our player tank:

Our player and tank in action

The previous screenshot shows an AI agent with touch and perspective senses looking for an enemy aspect. Move the player tank in front of the AI character, and you'll get the Enemy detected message. If you go into the editor view while running the game, you should see the debug drawings being rendered. This is because of the OnDrawGizmos method, implemented in ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.