Ok so basically i need help in deducting health when hunger = or < 0 and when hunger = 100 health regens 10 per 30 seconds and also make it so hunger slowly goes down overtime im unsure how to do this if you can point me in the right direction that would be great this is what i have so far the hunger dosent seem to lower at all for some reason
#pragma strict
var MaxHealth = 100;
var Health : int;
var MaxHunger = 100;
var Hunger : int;
var HealthlabelPos : Rect = Rect(100,100,100,20);
var HungerlabelPos : Rect = Rect(200,100,100,20);
function Start ()
{
Health = MaxHealth;
Hunger = MaxHunger;
}
function Update()
{
InvokeRepeating("Hungry", 1, 30);
}
function ApplyDammage (TheDamage : int)
{
Health -= TheDamage;
if(Health <= 0)
{
Dead();
}
}
function Hungry()
{
if (Hunger >= 1 || Hunger <= 100)
{
var Hunger =-1;
}
}
function Dead()
{
respawnMenu.playerIsDead = true;
Health = MaxHealth;
}
function RespawnStats ()
{
Health = MaxHealth;
}
function OnGUI()
{
GUI.Label(HealthlabelPos, "Health:" + Health);
GUI.Label(HungerlabelPos, "Hunger:" + Hunger);
}