Files
favilla_problem/UI/HPBar.cs
2026-06-29 19:26:37 +09:00

34 lines
676 B
C#

using Core;
namespace UI
{
public class HPBar : ComponentBase
{
private IHealthView _target;
public void Bind(IHealthView target)
{
Unbind();
_target = target;
if (_target == null) return;
_target.HPChanged += RefreshHP;
RefreshHP(target.MaxHP, target.CurrentHP);
}
public void Unbind()
{
if (_target != null) _target.HPChanged -= RefreshHP;
_target = null;
}
public void RefreshHP(int maxHP,int currentHP)
{
//UI 갱신
}
public override void OnDestroy() => Unbind();
}
}