using UnityEngine; using TMPro; public class UIController : MonoBehaviour { public static UIController instance; public void Awake() { instance = this; } public TMP_Text playerManaTxt, playerHealthTxt, enemyHealthTxt; public GameObject manaWarning; public GameObject handWarning; public float manaWarningTime; public GameObject drawCardBtn, endTurnBtn; public UIDamageIndicator playerDamage, enemyDamage; private float manaWarningCounter; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } // Update is called once per frame void Update() { if(manaWarningCounter > 0) { manaWarningCounter -= Time.deltaTime; if(manaWarningCounter <= 0) { manaWarning.SetActive(false); handWarning.SetActive(false); } } } public void SetPlayerManaText(int manaAmount) { playerManaTxt.text = "Mana: " + manaAmount; } public void SetPlayerHealthText(int healthAmount) { playerHealthTxt.text = "Player Health: " + healthAmount; } public void SetEnemyHealthText(int healthAmount) { enemyHealthTxt.text = "Enemy Health: " + healthAmount; } public void ShowManaWarning() { manaWarning.SetActive(true); manaWarningCounter = manaWarningTime; } public void ShowHandSizeWarning() { handWarning.SetActive(true); manaWarningCounter = manaWarningTime; } public void DrawCard() { DeckController.instance.DrawCardForMana(); } public void EndPlayerTurn() { BattleController.instance.EndPlayerTurn(); } }