Hiya guise. I have a script here that works like a timer. And essentially i want it to only record when my NightVision is enabled (when you press N button), and when you disable nightvision the timer pauses, to start from where it was when you enable nightvision again etc. How can i go about doing this? Suggestions would be much appreciated!
CODE:
#pragma strict
private var startTime : float;
var textTime : String;
function Start ()
{
startTime = Time.time;
}
function OnGUI ()
{
var guiTime = Time.time - startTime;
var minutes : int = guiTime / 60;
var seconds : int = guiTime % 60;
var fraction : int = (guiTime * 100) % 100;
textTime = String.Format ("REC {0:00}:{1:00}:{2:00}", minutes, seconds, fraction);
GetComponent(GUIText).text = textTime;
GetComponent (GUIText).color = Color.red;
GetComponent (GUIText).pixelOffset = Vector2 (-480, 250);
GetComponent (GUIText).fontSize = 25;
}