I have a lives system working, and I need 2 easy things to happen here. When the player collides with object tagged “woman” I need a sound effect to play, and when the lives system I have gets to 0 I need the level to restart. If you can help me that would be great, I’ll post the two scripts I have.
This is on the player move script.
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Woman")
{
HealthControl.LIVES -= 1;
}
}
This is on the gui hud I have.
var health1 : Texture2D;
var health2 : Texture2D;
static var LIVES = 2;
function Update ()
{
switch(LIVES)
{
case 2:
guiTexture.texture = health2;
break;
case 1:
guiTexture.texture = health1;
break;
case 0:
//new script game over
break;
}
}