![alt text][1]
Hi below is a working script.This script works in displaying a timer
displaying 00:00:00>to 00:00:01 in Hour,Min,Second.
now is runs for every 1mins my GUI.Label( Rect( 5, 25, 100, 100 ), FuelGauge[displayMinutes * 1] ); my FuelGauge[will +1],
So nows the point.i only have FuelGauge0-10,so after 10mins my fuelGauge texture gone.how am i suppose to make it stay at -------- FuelGauge[10] and show a text “no Fuel” can any1 help Thx very Much …
When you looking at the image below,i wanted when the fuel reach 0 it will hold there,but not disspear . or any1 have better idea for making fuel run just like a car,means when start fuel drop and car stop fuel pause and when no fuel i want it explode
private var startTime;
private var restSeconds : int;
private var roundedRestSeconds : int;
private var displaySeconds : int;
private var displayMinutes : int;
private var displayHours : int;
var countDownSeconds : int;
var FuelGauge : Texture;
function Awake() {
startTime = Time.time;
}
function OnGUI () {
//make sure that your time is based on when this script was first called
//instead of when your game started
var guiTime = Time.time + startTime;
restSeconds = countDownSeconds + (guiTime);
GUI.Label( Rect( 5, 25, 100, 100 ), FuelGauge[displaySeconds * 1] );
//display the timer
roundedRestSeconds = Mathf.CeilToInt(restSeconds);
displaySeconds = roundedRestSeconds % 60;
displayMinutes = roundedRestSeconds / 60;
displayHours = roundedRestSeconds / 60;
text = String.Format ("{0:00}:{0:00}:{1:00}", displayMinutes, displaySeconds);
GUI.Label (Rect (400, 25, 100, 30), text);
}
function Update(){
if ( displaySeconds > 10 ) {
GUI.Label( Rect( 5, 25, 100, 100 ), FuelGauge[10]);
GUI.Text(Rect(5, 50,100,100),"No Fuel");
}
else if ( displaySeconds < 0 ) {
displaySeconds = 0;
}
}