#pragma strict
var health : float = 100.0;
var hunger : float = 100.0;
function Start () {
}
function Update () {
hunger -= Time.deltaTime/3;
if (hunger <=5){
health --;
}
if (health <=0){
print ("Moriste!");
}
health = Mathf.(lamp(health, 0.0, 100.0);
hunger = Mathf.(lamp(hunger, 0.0, 100.0);
}
function OntriggerEnter (other : Collider) {
if (other.gameObject.name == ("Banana")&& hunger <=90.0){
health += 10;
Destroy (other.gameObject.transform.parent.gameObject);
}
}
↧