mixedcards/Assets/Battle/UI/EnergyUI.cs
2020-09-20 15:26:18 -04:00

34 lines
752 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EnergyUI : MonoBehaviour
{
public Text text;
private EnergyPool pool;
public void Init(EnergyPool pool) {
this.pool = pool;
}
// Start is called before the first frame update
void Start()
{
Render();
}
private void Render()
{
string currentEnergyString = "" + this.pool.Energy;
if (this.pool.Energy == 0) {
currentEnergyString = "<color=red>" + currentEnergyString + "</color>";
}
text.text = "Energy: " + currentEnergyString + " / " + this.pool.MaxEnergy;
}
public void NotifyEnergyChanged() {
Render();
}
}