Leaderboard

This commit is contained in:
magn9775
2024-04-26 10:58:34 +02:00
parent dbfbe1b926
commit 7152a5f4e5
6 changed files with 162 additions and 15 deletions

View File

@@ -5,13 +5,17 @@ using TMPro;
public class WinScript : MonoBehaviour
{
public TextMeshProUGUI MainText;
public TextMeshProUGUI MainText2;
public List<string> leaderboard;
public List<string> time;
public GameObject winner;
void Start()
{
leaderboard = GameObject.Find("GameManager").GetComponent<GameManager>().playersFinished;
time = GameObject.Find("GameManager").GetComponent<GameManager>().playerTimes;
}
@@ -19,10 +23,15 @@ public class WinScript : MonoBehaviour
private void Update()
{
MainText.text = "Leaderboard: ";
MainText2.text = "\n";
for (var i = 0; i < leaderboard.Count; i++){
MainText.text += "\n" + (i+1) + "." + leaderboard[i] + "(" + time[i] + ")";
MainText.text += "\n" + (i+1) + "." + leaderboard[i];
MainText2.text += "\n(" + time[i] + ")";
}
}
}