Sunday, March 9, 2014

Shield Script

// Shield Script

//Inspector variables
var shieldStrength: int = 3;

//Private variables

function OnTriggerEnter (other : Collider)
{
if (other.tag =="astroid")
{
shieldStrength -= 1;
}
}

function Update ()
{
if(shieldStrength <= 0)
{
Destroy(gameObject);
}
}

No comments:

Post a Comment