Add wall hit sound and animation

This commit is contained in:
2025-03-10 11:58:45 -07:00
parent d8c5bc8f78
commit 23049b3231
11 changed files with 189 additions and 47 deletions

View File

@@ -3,6 +3,7 @@ using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
@@ -17,6 +18,8 @@ public partial class InGameAudio : Node
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
#region BGM Nodes
[Node] public IDimmableAudioStreamPlayer MenuBgm { get; set; } = default!;
@@ -32,6 +35,8 @@ public partial class InGameAudio : Node
#region SFX Nodes
[Node] public IAudioStreamPlayer PlayerAttackSFX { get; set; } = default!;
[Node] public IAudioStreamPlayer PlayerAttackWallSFX { get; set; } = default!;
[Node] public IAudioStreamPlayer MenuScrollSFX { get; set; } = default!;
[Node] public IAudioStreamPlayer EquipSFX { get; set; } = default!;
@@ -58,6 +63,7 @@ public partial class InGameAudio : Node
InGameAudioLogic.Set(AppRepo);
InGameAudioLogic.Set(GameEventDepot);
InGameAudioLogic.Set(Player);
InGameAudioLogic.Set(GameRepo);
InGameAudioBinding = InGameAudioLogic.Bind();
@@ -69,7 +75,9 @@ public partial class InGameAudio : Node
.Handle((in InGameAudioLogic.Output.PlayMenuBackSound _) => PlayMenuBackSound())
.Handle((in InGameAudioLogic.Output.PlayInventorySortedSound _) => PlayInventorySortedSound())
.Handle((in InGameAudioLogic.Output.PlayHealingItemSound _) => PlayHealingItemSound())
.Handle((in InGameAudioLogic.Output.PlayTeleportSound _) => PlayTeleportSound());
.Handle((in InGameAudioLogic.Output.PlayTeleportSound _) => PlayTeleportSound())
.Handle((in InGameAudioLogic.Output.PlayPlayerAttackSound _) => { PlayerAttackSFX.Stop(); PlayerAttackSFX.Play(); })
.Handle((in InGameAudioLogic.Output.PlayPlayerAttackWallSound _) => { PlayerAttackWallSFX.Stop(); PlayerAttackWallSFX.Play(); });
InGameAudioLogic.Start();
}

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://b16ejcwanod72"]
[gd_scene load_steps=15 format=3 uid="uid://b16ejcwanod72"]
[ext_resource type="Script" uid="uid://2mnouyn1jcqs" path="res://src/audio/InGameAudio.cs" id="1_gpmcr"]
[ext_resource type="AudioStream" uid="uid://dfu0fksb6slhx" path="res://src/audio/music/droney.mp3" id="2_8hfyr"]
@@ -6,7 +6,9 @@
[ext_resource type="AudioStream" uid="uid://d2jrktp06xsba" path="res://src/audio/music/crossing-the-gate.mp3" id="3_wbmd6"]
[ext_resource type="AudioStream" uid="uid://dn2e2hqujlia1" path="res://src/audio/music/tar-winds.mp3" id="4_surnl"]
[ext_resource type="AudioStream" uid="uid://t3g04u722f2k" path="res://src/audio/music/useless immune system-1.mp3" id="6_agr3r"]
[ext_resource type="AudioStream" uid="uid://cn8cugshq3o8k" path="res://src/audio/sfx/PlayerHitWallSFX.wav" id="7_8vh2f"]
[ext_resource type="AudioStream" uid="uid://dor0in0x2fg48" path="res://src/audio/sfx/TempFFVII/menu-move.ogg" id="7_777nl"]
[ext_resource type="AudioStream" uid="uid://d1mlduwauechv" path="res://src/audio/sfx/PlayerAttackSFX.wav" id="7_wtvpb"]
[ext_resource type="AudioStream" uid="uid://r1tryiit38i8" path="res://src/audio/sfx/TempFFVII/menu-back.ogg" id="8_1xcgo"]
[ext_resource type="AudioStream" uid="uid://bjj61s8q2gwb8" path="res://src/audio/sfx/TempFFVII/junction.ogg" id="8_kwybb"]
[ext_resource type="AudioStream" uid="uid://myx4s8lmarc2" path="res://src/audio/sfx/TempFFVII/something-earned.ogg" id="10_3lcw5"]
@@ -56,46 +58,45 @@ script = ExtResource("2_857rw")
[node name="PlayerAttackSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
script = ExtResource("2_857rw")
stream = ExtResource("7_wtvpb")
volume_db = -5.0
[node name="PlayerAttackWallSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("7_8vh2f")
volume_db = -5.0
[node name="MenuScrollSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("7_777nl")
volume_db = -10.0
script = ExtResource("2_857rw")
[node name="MenuBackSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("8_1xcgo")
volume_db = -10.0
script = ExtResource("2_857rw")
[node name="EquipSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("8_kwybb")
volume_db = -10.0
script = ExtResource("2_857rw")
[node name="HealSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("10_3lcw5")
volume_db = -10.0
script = ExtResource("2_857rw")
[node name="TeleportSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("11_offhc")
volume_db = -18.0
script = ExtResource("2_857rw")
[node name="InventorySortedSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("12_wprjr")
volume_db = -15.0
script = ExtResource("2_857rw")
[node name="HealingItemSFX" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("10_3lcw5")
volume_db = -15.0
script = ExtResource("2_857rw")

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d1mlduwauechv"
path="res://.godot/imported/PlayerAttackSFX.wav-25ff4e405f0437faa32be96b9f5ca832.sample"
[deps]
source_file="res://src/audio/sfx/PlayerAttackSFX.wav"
dest_files=["res://.godot/imported/PlayerAttackSFX.wav-25ff4e405f0437faa32be96b9f5ca832.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cn8cugshq3o8k"
path="res://.godot/imported/PlayerHitWallSFX.wav-bee36ba71b5478424176ab61368ea9f8.sample"
[deps]
source_file="res://src/audio/sfx/PlayerHitWallSFX.wav"
dest_files=["res://.godot/imported/PlayerHitWallSFX.wav-bee36ba71b5478424176ab61368ea9f8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -13,6 +13,8 @@ public partial class InGameAudioLogic
#region SFX
public readonly record struct PlayPlayerAttackSound;
public readonly record struct PlayPlayerAttackWallSound;
public readonly record struct PlayMenuScrollSound;
public readonly record struct PlayEquipSound;

View File

@@ -1,4 +1,5 @@
using Chickensoft.Introspection;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
@@ -14,6 +15,7 @@ public partial class InGameAudioLogic
var player = Get<IPlayer>();
OnOverworldEntered();
var gameEventDepot = Get<IGameEventDepot>();
var gameRepo = Get<IGameRepo>();
gameEventDepot.OverworldEntered += OnOverworldEntered;
gameEventDepot.DungeonAThemeAreaEntered += OnDungeonAThemeEntered;
gameEventDepot.MenuScrolled += OnMenuScrolled;
@@ -25,11 +27,14 @@ public partial class InGameAudioLogic
gameEventDepot.HealingItemConsumed += OnHealingItemConsumed;
gameEventDepot.RestorativePickedUp += OnRestorativePickedUp;
gameEventDepot.TeleportEntered += OnTeleportEntered;
gameRepo.PlayerAttack += OnPlayerAttack;
gameRepo.PlayerAttackedWall += OnPlayerAttackWall;
});
OnDetach(() =>
{
var gameEventDepot = Get<IGameEventDepot>();
var player = Get<IPlayer>();
var gameRepo = Get<IGameRepo>();
gameEventDepot.OverworldEntered -= OnOverworldEntered;
gameEventDepot.DungeonAThemeAreaEntered -= OnDungeonAThemeEntered;
gameEventDepot.MenuScrolled -= OnMenuScrolled;
@@ -39,9 +44,15 @@ public partial class InGameAudioLogic
player.EquippedAccessory.Changed -= OnEquippedItem;
gameEventDepot.InventorySorted -= OnInventorySorted;
gameEventDepot.TeleportEntered -= OnTeleportEntered;
gameRepo.PlayerAttack -= OnPlayerAttack;
gameRepo.PlayerAttackedWall -= OnPlayerAttackWall;
});
}
private void OnPlayerAttack() => Output(new Output.PlayPlayerAttackSound());
private void OnPlayerAttackWall() => Output(new Output.PlayPlayerAttackWallSound());
private void OnRestorativePickedUp(Restorative restorative) => Output(new Output.PlayHealingItemSound());
private void OnMenuBackedOut() => Output(new Output.PlayMenuBackSound());