Game Development Reference
In-Depth Information
5.
Save the script.
6.
Click Play, enter the garden, and try lasering the zombie bunnies (Figure 11-32 ).
Figure 11-32. Lasering the zombie bunnies
Here you are directly calling the DestroyBun function in the ReceivedHits script, so you are
bypassing the explosion from the potato ammo and the green globs. Also, because the laser is set
to destroy only objects with the Invader tag, it will not destroy plants. This will afford the zombie
bunnies hiding in the corn patch a bit of protection.
A little sound effect, say of a sizzling sound, would be a nice touch. The sound should come from the
hit point, but the zombie bunny already has a death scream assigned to its Audio Source. The Laser
Light will be close enough to do the job, and the LaserBeam script already has access to it.
7.
Select the Laser Light object.
8.
Add an Audio Source component.
9.
Assign the Zap audio clip to it, and uncheck “Play on Awake.”
Back in the LaserBeam script, add the following beneath the SendMessage line:
10.
hitLight.audio.Play(); // cue the fx
 
Search WWH ::




Custom Search