Files
racesm/Assets/Scripts/WinScript.cs
2024-04-26 10:58:34 +02:00

38 lines
848 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
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;
}
private void Update()
{
MainText.text = "Leaderboard: ";
MainText2.text = "\n";
for (var i = 0; i < leaderboard.Count; i++){
MainText.text += "\n" + (i+1) + "." + leaderboard[i];
MainText2.text += "\n(" + time[i] + ")";
}
}
}