I am having trouble working out why I cant get time.deltaTime to work, basically my little timer is going down at a very fast speed, should take one hundred seconds, takes about 4. I have tried changing the number I am multiplying with time.deltaTime, but it doesnt effect anything. I am not calling it through ongui so as far as I understand, I should be able to get it to decrease at 1 point per second.
I’ve read the docs, but I think I am missing something simple.
here is my code.
#pragma strict
var airTank : Transform;
var airDistance = 10;
private var airCloseEnough = false;
var ourHealth : int = 100;
var maxHealth : int = 100;
var ourAir : int = 100;
var maxAir : int = 100;
function Start () {
}
function Update ()
{
if (ourHealth >= maxHealth)
{
ourHealth = maxHealth;
}
if(ourAir >= maxAir)
{
ourAir = maxAir;
}
ourAir -=1* Time.deltaTime;
if(ourAir <=0)
{
print("dead");
}
if(Vector3.Distance(transform.position, airTank.position) < airDistance)
{
airCloseEnough = true;
}
if(Vector3.Distance(transform.position, airTank.position) > airDistance)
{
airCloseEnough = false;
}
if(airCloseEnough == true)
{
ourAir=maxAir;
}
}