// Jimmy Vegas Unity Tutorial
// These scripts will manage your lap times
//LAP TIME MANAGER SCRIPT
using [Link];
public class LapTimeManager : MonoBehaviour {
public static int MinuteCount;
public static int SecondCount;
public static float MilliCount;
public static string MilliDisplay;
public GameObject MinuteBox;
public GameObject SecondBox;
public GameObject MilliBox;
void Update () {
MilliCount += [Link] * 10;
MilliDisplay = [Link] ("F0");
[Link]<Text> ().text = "" + MilliDisplay;
if (MilliCount >= 10) {
MilliCount = 0;
SecondCount += 1;
}
if (SecondCount <= 9) {
[Link]<Text> ().text = "0" + SecondCount + ".";
} else {
[Link]<Text> ().text = "" + SecondCount + ".";
}
if (SecondCount >= 60) {
SecondCount = 0;
MinuteCount += 1;
}
if (MinuteCount <= 9) {
[Link]<Text> ().text = "0" + MinuteCount + ":";
} else {
[Link]<Text> ().text = "" + MinuteCount + ":";
}
}
}
//LAP COMPLETE SCRIPT
using [Link];
public class LapComplete : MonoBehaviour {
public GameObject LapCompleteTrig;
public GameObject HalfLapTrig;
public GameObject MinuteDisplay;
public GameObject SecondDisplay;
public GameObject MilliDisplay;
public GameObject LapTimeBox;
void OnTriggerEnter () {
if ([Link] <= 9) {
[Link]<Text> ().text = "0" +
[Link] + ".";
} else {
[Link]<Text> ().text = "" +
[Link] + ".";
}
if ([Link] <= 9) {
[Link]<Text> ().text = "0" +
[Link] + ".";
} else {
[Link]<Text> ().text = "" +
[Link] + ".";
}
[Link]<Text> ().text = "" +
[Link];
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] (true);
[Link] (false);
}