using UnityEngine; using UnityEngine.UI; using TMPro; public class ShieldUIHandler : MonoBehaviour { [SerializeField] private Image shieldIcon; [SerializeField] private TextMeshProUGUI countText; // UI 업데이트만 담당하는 함수 public void UpdateShieldUI(int count) { if (countText != null) { countText.text = count.ToString(); // 개수가 0이면 텍스트 숨기기 countText.gameObject.SetActive(count > 0); } if (shieldIcon != null) { // 색상 조절 로직 shieldIcon.color = (count > 0) ? Color.white : new Color(0.2f, 0.2f, 0.2f, 0.5f); } } }