0% found this document useful (0 votes)
4 views2 pages

Unity Lap Time Manager Script

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Unity Lap Time Manager Script

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// 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);
}

You might also like