.
This commit is contained in:
35
Assets/Scripts/GameManager.cs
Normal file
35
Assets/Scripts/GameManager.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
public static GameManager Instance;
|
||||
|
||||
public GameObject resultPanel;
|
||||
public TextMeshProUGUI resultText;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void ShowWinner(string loserName)
|
||||
{
|
||||
resultPanel.SetActive(true);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user