mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Hurt sound
This commit is contained in:
parent
c6aad99d79
commit
b91e7dbf70
11 changed files with 100 additions and 22 deletions
19
Scripts/Components/FSM/Player/HurtSoundPlayer.cs
Normal file
19
Scripts/Components/FSM/Player/HurtSoundPlayer.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/HurtSoundPlayer.cs.uid
Normal file
1
Scripts/Components/FSM/Player/HurtSoundPlayer.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c1cjjk0ghptyx
|
||||
Loading…
Add table
Add a link
Reference in a new issue