So my game is a game where you have to put objects in containers. Once all the objects are in the containers. I want the timer to stop and pull up an end level GUI that shows the score, the time it took and the bonus… which gives you the final score. Problem is… I am not REALLY a programmer…
I was able to program the timer counter
var min : int;
var sec : int;
var fraction : int;
var timecount : float;
var starttime : float;
var timeCounter : GUIText;
function Start ()
{
starttime = Time.time;
}
function Update () {
timecount = Time.time - starttime;
min = (timecount/60f);
sec = (timecount % 60f);
fraction = ((timecount * 10) %10);
timeCounter.text = String.Format("{00:00}:{1:00}:{2:00}",min,sec,fraction);
}
and the score
//This keeps count of the score
static var playerScore : int;
// This variable is a string
var scorePrint;
//boolean that changes the ball's status
var IsInside : boolean;
//gets the game object from inspector
var Trigger : GameObject;
//This variable allows us to put a GUIText game object in the inspector
var Scorecount : GUIText;
function start()
{
IsInside =false ;
}
function OnTriggerEnter(other : Collider){
if (other.gameObject== Trigger IsInside == false){
playerScore =playerScore+10;
IsInside = true;
}
else if (other.gameObject==Trigger IsInside == true){
playerScore =playerScore-10;
IsInside = false;
}
}
function Update()
{
scorePrint = playerScore.ToString();
Scorecount.text = String.Format(scorePrint);
}
Now I want to stop the timer when the Scorecount.text hits 60
the script was put on each of the objects hitting the trigger…
sample of the game here…
http://rblumenschein.webs.com/demooftiltgame.htm
PLEASE someone… how should I write the stop time counter code and should I attach that to the timer code or should I create another code
AND how do I get GUI to actually pull up on the screen once the level is ended…