2025-03-08 13:33:19 -05:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class WinScreen : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static WinScreen Instance;
|
|
|
|
|
public List<TextMeshProUGUI> playerTexts;
|
|
|
|
|
|
2025-03-28 17:39:07 -04:00
|
|
|
private void Awake() // Ensures only one instance of WinScreen exists
|
2025-03-08 13:33:19 -05:00
|
|
|
{
|
|
|
|
|
if (Instance == null)
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Destroy(this.gameObject);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-28 17:39:07 -04:00
|
|
|
public void ShowWinScreen(int player) // Triggers the win screen to appear
|
2025-03-08 13:33:19 -05:00
|
|
|
{
|
|
|
|
|
foreach (TextMeshProUGUI playerText in playerTexts)
|
|
|
|
|
{
|
|
|
|
|
playerText.text = "Player " + player;
|
|
|
|
|
if (playerText.color != Color.black)
|
|
|
|
|
{
|
|
|
|
|
playerText.color = GameManager.playerColors[player - 1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetComponent<Animator>().SetTrigger("win");
|
|
|
|
|
}
|
|
|
|
|
}
|