1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
using UnityEngine; using UnityEngine.UI; public class BlockRechargeUI : MonoBehaviour { private Block block; private Image img; private void Start() { img = GetComponentInChildren<Image>(); block = GetComponentInParent<Block>(); } private void Update() { img.fillAmount = block.counter / block.Cooldown(); } }