using UnityEngine; using System; // ⭐ Action 사용을 위해 필요 public class TrainingDummy : MonoBehaviour, IDamageable { [Header("더미 설정")] [SerializeField] private float maxHP = 9999f; private float _currentHP; private Animator _animator; // ⭐ UI가 이 신호를 듣고 게이지를 줄입니다. public event Action OnHealthChanged; private void Start() { _currentHP = maxHP; _animator = GetComponent(); } public void TakeDamage(float amount) { _currentHP -= amount; // ⭐ UI에 현재 체력과 최대 체력 정보를 보냅니다. OnHealthChanged?.Invoke(_currentHP, maxHP); Debug.Log($"[더미] 피격! 데미지: {amount} | 남은 체력: {_currentHP}"); if (_animator != null) { _animator.Play("Hit", 0, 0f); } } }