If looks could kill
We got this far. We might as well try to kill Ethan (haha!). Here are the specifications for this new feature:
- Looking at Ethan hits him with our line-of-sight ray gun
- 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
The KillTarget script
This time, we'll attach the script to a new empty GameController
object by performing the following steps:
- Create an empty game object and name it
GameController
. - Attach a new C# script to it, using Add Component, named
KillTarget
. - Open the script in MonoDevelop.
Here's the completed KillTarget.cs
script:
using UnityEngine; using System.Collections; public class KillTarget ...
Get Unity Virtual Reality Projects 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.