Files
Crash-Course/Assets/Scripts/WinScreen.cs
2025-03-20 14:45:29 -04:00

36 lines
774 B
C#

using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class WinScreen : MonoBehaviour
{
public static WinScreen Instance;
public List<TextMeshProUGUI> playerTexts;
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Destroy(this.gameObject);
}
}
public void ShowWinScreen(int player)
{
foreach (TextMeshProUGUI playerText in playerTexts)
{
playerText.text = "Player " + player;
if (playerText.color != Color.black)
{
playerText.color = GameManager.playerColors[player - 1];
}
}
GetComponent<Animator>().SetTrigger("win");
}
}