We've got this far, so we might as well try to kill the zombie, right? (haha!). Here are the specifications for this new feature:
- Looking at Ethan hits him with our line-of-sight raygun.
- Sparks are emitted when the gun hits its target.
- After 3 seconds of being hit, Ethan is killed.
- When he's killed, Ethan explodes (we get a point) and then he respawns at a new location.
Again, if you're new to programming, it's OK to just follow along and copy/paste the code. Alternatively, you can use a completed copy of these scripts, which can found in the download files for this book from the publisher. I will try to include a little explanation for each line of code as we go through it. The first thing we'll do is write a script, named KillTarget, which will kill Ethan when the user stares at him. Then, we'll add some visual effects, using the Unity particle system...