I am using my progress bar thing, but it gives me an error. If anyone knows why, please help me out!
#pragma strict
var spawner = GetComponent();
var barRenderer = spawner.instance; // bar renderer allows to access rendering properties
var bar = barRenderer.GetComponent(); // allows to change bar value
// bar.ValueF = 1.0f; - will fill the bar to maximum value
var maxHealth:float = 1000;
var Health:float = 1000;
function ApplyDammage (TheDammage : int)
{
Health -= TheDammage;
bar.ValueF = Health/maxHealth;
if(Health <= 0)
{
Dead();
}
}
function Dead()
{
Destroy (gameObject);
}
Here is a picture of the errors: