What can I do about this error?
Currently I have an object that should die (Destroy currently) when health <= 0 and instead I get this error
here is the code that should rid me of the object:
// vars
var health : float = 100;
var armour : float = 0;
var shield : float = 0;
// supporting vars
var damage_hull : float = 0;
var damage_shield : float = 0;
var temp : float = 0;
// control vars
var replace : boolean = false;
// objects
var explosion : Transform;
var replacement : Transform;
var origional : Transform;
function Update ()
{
if (health > 0.0 && shield <= 0.0)
{
if (armour > 0)
{
armour = armour - ( damage_hull / 2 );
temp = damage_hull - armour;
if (temp > 0)
{
damage_hull = temp;
}
}
health = health - damage_hull;
}
if (health <= 0.0)
{
if (replace == false)
{
//Instantiate(explosion,transform.position, transform.rotation);
Destroy (origional);
}
else
{
Instantiate(replacement,transform.position, transform.rotation);
Destroy (origional);
}
}
}
function Hull_Damage_receiver (hull : float)
{
damage_hull = hull;
}
function Shield_Damage_receiver (shield : float)
{
damage_shield = shield;
}