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 = "" + currentEnergyString + ""; } text.text = "Energy: " + currentEnergyString + " / " + this.pool.MaxEnergy; } public void NotifyEnergyChanged() { Render(); } }