Our work in Chapter 6, Talking Heads, left us with an enemy that becomes aware of the player on a button click. Let's begin where we left off and improve this to make a smarter enemy that automatically attacks the player when he comes within a certain range.
In the Unity project, open
Chapter9_Startby navigating to File | Open Scene… | Chapter9_Start.
The scene consists of the main office geometry and a single female zombie character. The
FPSControllerprefab will allow us to navigate the scene.
Press the Play button in the top center of the Unity interface.
In the next step, we will add the zombie's AI script and allow her to detect the player.
We are starting with the zombie's script that we completed in Chapter 6, Talking Heads. The enemy is able to target the player, but we...