Started implementing SFX
Fixed Shield animation jumps and secondary attack Fixed demon wall stone behavior Made overworld ambient sounds unpausable
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public partial class AudioManager : Node
|
||||
{
|
||||
#pragma warning disable IDE0044 // Add readonly modifier
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
|
||||
private static string _sfxPath = $"res://src/audio/sfx";
|
||||
private AudioStreamPlayer _audioPlayer;
|
||||
private IDictionary<SoundEffects, AudioStream> _sfxDictionary;
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
|
||||
#pragma warning restore IDE0044 // Add readonly modifier
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_audioPlayer = new AudioStreamPlayer();
|
||||
_sfxDictionary = new Dictionary<SoundEffects, AudioStream>();
|
||||
var soundEffects = Enum.GetValues(typeof(SoundEffects));
|
||||
foreach (var effect in soundEffects)
|
||||
_sfxDictionary.Add((SoundEffects)effect, GD.Load<AudioStream>(_sfxPath + effect + ".ogg"));
|
||||
}
|
||||
|
||||
public void Play(SoundEffects soundEffect)
|
||||
{
|
||||
_sfxDictionary.TryGetValue(soundEffect, out var stream);
|
||||
_audioPlayer.Stream = stream;
|
||||
_audioPlayer.Play();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public enum SoundEffects
|
||||
{
|
||||
Cancel,
|
||||
Equip,
|
||||
Heal,
|
||||
MenuBack,
|
||||
MoveThroughOptions,
|
||||
PlayerAttack,
|
||||
PlayerHitWall,
|
||||
Sort,
|
||||
Unequip
|
||||
}
|
||||
Reference in New Issue
Block a user