In the Project panel, scroll down until the
PACKT_Scriptsfolder is visible.
Double-click on it to make its contents visible in the Assets panel.
zombie_readyand double-click on it to open the script in MonoDevelop.
We will start by adding a few variables. At the top of the script, add the following lines of code:
var target : Transform; var alerted : boolean = false; var snarlSound : AudioClip; var soundReady : boolean = true;
target variable will store the player character's position. The next variable, alerted is a boolean. It is basically an on/off switch that will allow the zombie to go into a new routine.
The next two variables deal with the sound that we will be using to make it clear that the zombie has been alerted.