So, right now my hunger code is;
timer=Time.deltaTime;
if(timer>10)
{
Hunger-=1;
HungerReset();
}
But I want Hunger to decrease every five seconds. Any ideas?
If I left out any important information, let me know.
Okay, so none of the suggestions worked, but thanks for trying.
My new code is:
#pragma strict
var Hunger:int;
var MaxHunger:float=1000;
var timer:float;
function Start ()
{
Hunger=MaxHunger;
}
function Update ()
{
timer=Time.deltaTime;
if(timer>10){
function Hunger();{
for(i=Hunger;i>0;i--) {
yield WaitForSeconds(5.0);
}
}
}
}
The only problem is that Unity says:
Assets/Hunger.js(16,26): BCE0044: expecting (, found ‘Hunger’.
Does anyone know why?
Thanks!