winscreen

This commit is contained in:
magn9775
2024-04-26 12:26:47 +02:00
parent d49e58e008
commit caa6e28bec
4 changed files with 116 additions and 17 deletions

View File

@@ -2,19 +2,67 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Unity.VisualScripting;
public class WinScript : MonoBehaviour
{
public TextMeshProUGUI MainText;
public TextMeshProUGUI MainText2;
public List<string> leaderboard;
public List<string> time;
public GameObject winner;
public GameObject[] Garages;
private GameObject currentGarage;
void Start()
{
foreach (GameObject carGarage in Garages)
{
carGarage.SetActive(false);
}
leaderboard = GameObject.Find("GameManager").GetComponent<GameManager>().playersFinished;
time = GameObject.Find("GameManager").GetComponent<GameManager>().playerTimes;
if (leaderboard[0] == "Racecar")
{
currentGarage = Garages[6];
Garages[6].SetActive(true);
}
else if (leaderboard[0] == "Hotrod")
{
currentGarage = Garages[2];
Garages[2].SetActive(true);
}
else if (leaderboard[0] == "Icecream")
{
currentGarage = Garages[5];
Garages[5].SetActive(true);
}
else if (leaderboard[0] == "MuscleCar")
{
currentGarage = Garages[1];
Garages[1].SetActive(true);
}
else if (leaderboard[0] == "Pickup")
{
currentGarage = Garages[3];
Garages[3].SetActive(true);
}
else if (leaderboard[0] == "SchoolBus")
{
currentGarage = Garages[7];
Garages[7].SetActive(true);
}
else if (leaderboard[0] == "Sportscar")
{
currentGarage = Garages[4];
Garages[4].SetActive(true);
}
else if (leaderboard[0] == "StreetRacist")
{
currentGarage = Garages[0];
Garages[0].SetActive(true);
}
}
@@ -23,13 +71,18 @@ public class WinScript : MonoBehaviour
private void Update()
{
MainText.text = "Leaderboard: ";
MainText2.text = "\n";
MainText2.text = "Time: ";
for (var i = 0; i < leaderboard.Count; i++){
MainText.text += "\n" + (i+1) + "." + leaderboard[i];
MainText2.text += "\n(" + time[i] + ")";
}
}
private void FixedUpdate() {
currentGarage.transform.eulerAngles += Vector3.up * 0.7f;
//currentRotation = CurrentCar.transform.rotation;
}