2026-05-09 09:00:14 +07:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
|
|
public class GameManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static GameManager Instance;
|
|
|
|
|
|
|
|
|
|
public GameObject resultPanel;
|
|
|
|
|
public TextMeshProUGUI resultText;
|
2026-05-12 10:08:40 +07:00
|
|
|
public AudioSource audioSource;
|
|
|
|
|
public AudioClip audioClip;
|
2026-05-09 09:00:14 +07:00
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowWinner(string loserName)
|
|
|
|
|
{
|
|
|
|
|
resultPanel.SetActive(true);
|
2026-05-12 10:08:40 +07:00
|
|
|
audioSource.PlayOneShot(audioClip);
|
2026-05-09 09:00:14 +07:00
|
|
|
if (loserName.Contains("Blue"))
|
|
|
|
|
resultText.text = "RED WIN!";
|
|
|
|
|
else
|
|
|
|
|
resultText.text = "BLUE WIN!";
|
|
|
|
|
|
|
|
|
|
Time.timeScale = 0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Again()
|
|
|
|
|
{
|
|
|
|
|
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
|
|
|
|
Time.timeScale = 1f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|