Game Development Reference
Fig 4.11 Adding spheres as
waypoints to the waypoint script.
to the new cube. Enter the code in Listing 4.20 . This will cause a Game
Over screen to pop open when either car collides with the cube.
Listing 4.20 Call a Game Over screen
private var winner = "";
private var playerLocation: Vector3;
private var npcLocation: Vector3;
//remember location and orientation of both cars at
playerLocation = GameObject.Find("Car Prefab").
npcLocation = GameObject.Find("Player2").
function OnTriggerEnter(collision: Collider)
//if there is no winner yet
if(winner == "")