Files

42 lines
903 B
C#
Raw Permalink Normal View History

2026-04-29 09:22:08 +09:00
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class ShootButtonUI : MonoBehaviour
{
[Header("References")]
public TMP_Text ammoText;
private ShootButton shootButton;
private int lastCurrent;
private int lastMax;
void Awake()
{
shootButton = GetComponent<ShootButton>();
}
public void UpdateAmmoUI(int current, int max)
{
lastCurrent = current;
lastMax = max;
if (ammoText != null)
ammoText.text = $"{current}/{max}";
}
public void SetReloading(bool reloading)
{
if (ammoText != null)
{
if (reloading)
ammoText.text = "Reload";
else
ammoText.text = $"{lastCurrent}/{lastMax}";
}
// 버튼 입력 차단/해제
if (shootButton != null)
shootButton.SetDisabled(reloading);
}
}