Hey guys, I have had a look at several different high score table questions already and I can’t get my head round any of them. I am needing to save the current time and then decide if its in first, second or third and then display it. This is the code I have so far and it manages to fill first place but it doesn’t then move first into second if first is beaten and it doesn’t put current in second if it doesn’t beat first and so on. Can someone please help me out?
public class highscore : MonoBehaviour
{
int current;
int first;
int second;
int third;
int seconds;
int minutes;
public GameObject Firstt;
public GameObject Secondd;
public GameObject Thirdd;
void Start ()
{
minutes = PlayerPrefs.GetInt("Minutes");
seconds = PlayerPrefs.GetInt("Seconds");
current = minutes *100 + seconds;
if (current > first)
{
second = first;
first = current;
current = 0;
}
if (current > second && current < first)
{
third = second;
second = current;
current = 0;
}
if (current > third && current < second && current < first)
{
third = current;
current = 0;
}
Firstt.GetComponent<TextMesh>().text= ("1ST PLACE - " + first);
Secondd.GetComponent<TextMesh>().text= ("2ND PLACE - " + second);
Thirdd.GetComponent<TextMesh>().text= ("3RD PLACE - " + third);
}