using Cirno.Scripts.Components.Actors;
using Godot;

namespace Cirno.Scripts.Components.FSM.Player;

public partial class HurtSoundPlayer : AudioStreamPlayer2D
{
    [Export] public PlayerDamageReceiver DamageReceiver { get; private set; }

    public override void _Ready()
    {
        DamageReceiver.HealthDecreased += OnHurt;
    }

    private void OnHurt(float value, float newValue, float maxValue)
    {
        this.Play();
    }
}