BattleUiManager.cs (1266B)
1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.UI; 5 using UnityEngine.SceneManagement; 6 7 public class BattleUiManager : MonoBehaviour { 8 9 private Canvas winnerScreen; 10 private Canvas cardHud; 11 private SpawnManagerV2 spawnManager; 12 13 private string oldWinText; 14 15 private void Start() 16 { 17 winnerScreen = transform.GetChild(0).GetComponent<Canvas>(); 18 oldWinText = winnerScreen.transform.GetChild(0).GetComponent<Text>().text; 19 spawnManager = GameObject.Find("SpawnManager").GetComponent<SpawnManagerV2>(); 20 } 21 22 public void Winner(string winner) 23 { 24 Text winnerText = winnerScreen.transform.GetChild(0).GetComponent<Text>(); 25 winnerText.text = winner + winnerText.text; 26 winnerScreen.gameObject.SetActive(true); 27 Debug.Log("Actually"); 28 } 29 30 public void RespawnButton() 31 { 32 winnerScreen.GetComponentInChildren<Text>().text = oldWinText; 33 winnerScreen.gameObject.SetActive(false); 34 spawnManager.Respawn(); 35 } 36 public void MainMenuButton() 37 { 38 winnerScreen.GetComponentInChildren<Text>().text = oldWinText; 39 winnerScreen.gameObject.SetActive(false); 40 SceneManager.LoadScene(0); 41 } 42 }