Re-implement audio managers
This commit is contained in:
30
Zennysoft.Game.Ma.Implementation/Audio/AudioManager.cs
Normal file
30
Zennysoft.Game.Ma.Implementation/Audio/AudioManager.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
7
Zennysoft.Game.Ma.Implementation/Audio/BGMPlayer.cs
Normal file
7
Zennysoft.Game.Ma.Implementation/Audio/BGMPlayer.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Zennysoft.Game.Implementation;
|
||||
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public partial class BGMPlayer : DimmableAudioStreamPlayer
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public enum BackgroundMusic
|
||||
{
|
||||
CrossingTheGate,
|
||||
Droney,
|
||||
TarWinds,
|
||||
UselessImmuneSystem
|
||||
}
|
||||
14
Zennysoft.Game.Ma.Implementation/Audio/SoundEffects.cs
Normal file
14
Zennysoft.Game.Ma.Implementation/Audio/SoundEffects.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public enum SoundEffects
|
||||
{
|
||||
Cancel,
|
||||
Equip,
|
||||
Heal,
|
||||
MenuBack,
|
||||
MoveThroughOptions,
|
||||
PlayerAttack,
|
||||
PlayerHitWall,
|
||||
Sort,
|
||||
Unequip
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://d2jrktp06xsba"
|
||||
path="res://.godot/imported/crossing-the-gate.mp3-f062dfcb3f59739ce7e55970f8091d25.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/music/crossing-the-gate.mp3"
|
||||
dest_files=["res://.godot/imported/crossing-the-gate.mp3-f062dfcb3f59739ce7e55970f8091d25.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/music/droney.mp3
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/music/droney.mp3
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://dfu0fksb6slhx"
|
||||
path="res://.godot/imported/droney.mp3-a35fe85a5df08f09cd4cf965e60dc611.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/music/droney.mp3"
|
||||
dest_files=["res://.godot/imported/droney.mp3-a35fe85a5df08f09cd4cf965e60dc611.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/music/tar-winds.mp3
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/music/tar-winds.mp3
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://dn2e2hqujlia1"
|
||||
path="res://.godot/imported/tar-winds.mp3-7ac6ab80e2c96dfbcd5e5c27c1154ff2.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/music/tar-winds.mp3"
|
||||
dest_files=["res://.godot/imported/tar-winds.mp3-7ac6ab80e2c96dfbcd5e5c27c1154ff2.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://6002a12ecfo5"
|
||||
path="res://.godot/imported/useless immune system.wav-90ff2c5c12784f54b1b15c7a7e4603b8.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/music/useless immune system.wav"
|
||||
dest_files=["res://.godot/imported/useless immune system.wav-90ff2c5c12784f54b1b15c7a7e4603b8.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=0
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Cancel.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Cancel.ogg
Normal file
Binary file not shown.
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Cancel.ogg.import
Normal file
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Cancel.ogg.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dci08kmwsu6k1"
|
||||
path="res://.godot/imported/Cancel.ogg-90240069a266fcef76dd638dfd79efd5.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/Cancel.ogg"
|
||||
dest_files=["res://.godot/imported/Cancel.ogg-90240069a266fcef76dd638dfd79efd5.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Equip.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Equip.ogg
Normal file
Binary file not shown.
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Equip.ogg.import
Normal file
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Equip.ogg.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://nebh8kbv638p"
|
||||
path="res://.godot/imported/Equip.ogg-217f5d9ca98d54921c4ec31e13fb9ba4.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/Equip.ogg"
|
||||
dest_files=["res://.godot/imported/Equip.ogg-217f5d9ca98d54921c4ec31e13fb9ba4.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Heal.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Heal.ogg
Normal file
Binary file not shown.
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Heal.ogg.import
Normal file
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Heal.ogg.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://myx4s8lmarc2"
|
||||
path="res://.godot/imported/Heal.ogg-05b7ed0ad880ef31e2dd13ac2428a53c.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/Heal.ogg"
|
||||
dest_files=["res://.godot/imported/Heal.ogg-05b7ed0ad880ef31e2dd13ac2428a53c.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/MenuBack.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/MenuBack.ogg
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://r1tryiit38i8"
|
||||
path="res://.godot/imported/MenuBack.ogg-4d59ead9ffd1dde11bf2c91a5ade19a4.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/MenuBack.ogg"
|
||||
dest_files=["res://.godot/imported/MenuBack.ogg-4d59ead9ffd1dde11bf2c91a5ade19a4.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dor0in0x2fg48"
|
||||
path="res://.godot/imported/MoveThroughOptions.ogg-d2ab68a21096bd510cf966df8d088ca2.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/MoveThroughOptions.ogg"
|
||||
dest_files=["res://.godot/imported/MoveThroughOptions.ogg-d2ab68a21096bd510cf966df8d088ca2.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/PlayerAttack.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/PlayerAttack.ogg
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dl300ljxjccju"
|
||||
path="res://.godot/imported/PlayerAttack.ogg-b72a90c320c3a6f764de2be3f71a8058.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/PlayerAttack.ogg"
|
||||
dest_files=["res://.godot/imported/PlayerAttack.ogg-b72a90c320c3a6f764de2be3f71a8058.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/PlayerHitWall.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/PlayerHitWall.ogg
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dvv6wd7rtbc7b"
|
||||
path="res://.godot/imported/PlayerHitWall.ogg-429bd11f2f509307596bb8d8ac73a08d.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/PlayerHitWall.ogg"
|
||||
dest_files=["res://.godot/imported/PlayerHitWall.ogg-429bd11f2f509307596bb8d8ac73a08d.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Sort.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Sort.ogg
Normal file
Binary file not shown.
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Sort.ogg.import
Normal file
19
Zennysoft.Game.Ma.Implementation/Audio/sfx/Sort.ogg.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://d3sn7c614uj2n"
|
||||
path="res://.godot/imported/Sort.ogg-c7758aed01332fd8ea77a27c6593a8bb.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/Sort.ogg"
|
||||
dest_files=["res://.godot/imported/Sort.ogg-c7758aed01332fd8ea77a27c6593a8bb.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Unequip.ogg
Normal file
BIN
Zennysoft.Game.Ma.Implementation/Audio/sfx/Unequip.ogg
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://bb1j3m60jns54"
|
||||
path="res://.godot/imported/Unequip.ogg-b3c6ba8a77b0e6d2ec671cb12640c764.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/audio/sfx/Unequip.ogg"
|
||||
dest_files=["res://.godot/imported/Unequip.ogg-b3c6ba8a77b0e6d2ec671cb12640c764.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Reference in New Issue
Block a user