Files

23 lines
561 B
C#
Raw Permalink Normal View History

using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class ShieldUIHandler : MonoBehaviour
{
[SerializeField] private Image shieldIcon;
[SerializeField] private TextMeshProUGUI countText;
public void UpdateShieldUI(int count)
{
if (countText != null)
{
countText.text = count.ToString();
countText.gameObject.SetActive(count > 0);
}
if (shieldIcon != null)
{
shieldIcon.color = (count > 0) ? Color.white : new Color(0.2f, 0.2f, 0.2f, 0.5f);
}
}
}