win screeen
This commit is contained in:
36
Assets/Scripts/WinScript.cs
Normal file
36
Assets/Scripts/WinScript.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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] + ")";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user