37 lines
859 B
C#
37 lines
859 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
public class WinScript : MonoBehaviour
|
|
{
|
|
public TextMeshProUGUI MainText;
|
|
public List<string> leaderboard;
|
|
public List<string> time;
|
|
|
|
void Start()
|
|
{
|
|
leaderboard = GameObject.Find("GameManager").GetComponent<GameManager>().PlayerFinished;
|
|
carColor = GameObject.Find("Car Data").GetComponent<CarData>().carColor;
|
|
|
|
foreach (GameObject car in Cars)
|
|
{
|
|
if (car.name == carType)
|
|
{
|
|
replaceCar(car, carColor);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
{
|
|
MainText.text = "Leaderboard: ";
|
|
for (var i = 0; i < leaderboard.Count; i++){
|
|
MainText.text += "\n" + (i+1) + "." + leaderboard[i] + "(" + time[i] + ")";
|
|
}
|
|
|
|
}
|
|
}
|
|
|