I’m attempting to make a timer class that parents its behavior to its derivatives. This behavior is counting down to zero when time is greater than zero.
Unfortunately, its not working, more specifically a timer derived from this timer class does not count down to zero when I run the scene. Why is this?
Below is the code used:
//Timers.
public class Timer
{
public var time: float;
function Update ()
{
if (time > 0)
{
time -= Time.deltaTime;
}
else
{
time = 0;
}
}
public function Timer(tm : float)
{
time = tm;
}
}
public var testTimer : Timer = new Timer(5);