Hey im using two scripts, startRace & endRace, which starts at 60 seconds counting down when you trigger it and stops when you hit the other trigger. Can i just add some coding into these codes which make it a guitext and displays on the screen. Thank you.
startRace :
using UnityEngine;
using System.Collections;
public class startRace : MonoBehaviour {
public bool raceStarted = false;
public float raceTimer = 60.0f;
public bool raceOver = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//Starts timer when race starts
if (raceStarted)
{
raceTimer -= Time.deltaTime;
}
if (raceTimer <= 0.0f)
{
raceOver = true;
raceStarted = false;
Application.LoadLevel(0);
}
}
void OnTriggerEnter(Collider raceTrig)
{
//Starts race
if(raceTrig.gameObject.tag == "Player")
{
raceStarted = true;
}
}
}
endRace:
using UnityEngine;
using System.Collections;
public class endRace : MonoBehaviour {
private startRace race;
// Use this for initialization
void Start () {
race = FindObjectOfType(typeof(startRace)) as startRace;
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider raceTrig)
{
//Stops timer and ends race
if(raceTrig.gameObject.tag == "Player")
{
race.raceStarted = false;
}
}
}