using Godot;

public partial class Target : StaticBody3D
{
  [Export]
  private int _maxHP = 100;
  private int _currentHP;

  [Export]
  private Healthbar _progressBar;

  public override void _Ready()
  {
    _currentHP = _maxHP;
  }

  public void OnHitEvent(int damage)
  {
    _currentHP -= damage;
    GD.Print($"Current HP: {_currentHP}");
    _progressBar.Update(_currentHP, _maxHP);

    if (_currentHP <= 0)
      QueueFree();
  }
}
