Hurt sound

This commit is contained in:
Marco 2025-05-22 14:47:47 +02:00
commit b91e7dbf70
11 changed files with 100 additions and 22 deletions

View file

@ -0,0 +1,19 @@
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();
}
}

View file

@ -0,0 +1 @@
uid://c1cjjk0ghptyx