diff --git a/src/app/App.tscn b/src/app/App.tscn index 2643c9ce..ad34286d 100644 --- a/src/app/App.tscn +++ b/src/app/App.tscn @@ -19,7 +19,6 @@ stretch = true unique_name_in_owner = true transparent_bg = true handle_input_locally = false -audio_listener_enable_2d = true size = Vector2i(1920, 1080) render_target_update_mode = 4 diff --git a/src/audio/state/InGameAudioLogic.State.cs b/src/audio/state/InGameAudioLogic.State.cs index 5a56e61d..7545047b 100644 --- a/src/audio/state/InGameAudioLogic.State.cs +++ b/src/audio/state/InGameAudioLogic.State.cs @@ -9,47 +9,5 @@ public partial class InGameAudioLogic [Meta] public partial record State : StateLogic { - public State() - { - OnAttach(() => - { - var gameEventDepot = Get(); - gameEventDepot.OverworldEntered += OnOverworldEntered; - gameEventDepot.DungeonAThemeAreaEntered += OnDungeonAThemeEntered; - gameEventDepot.MenuScrolled += OnMenuScrolled; - gameEventDepot.MenuBackedOut += OnMenuBackedOut; - gameEventDepot.EquippedItem += OnEquippedItem; - gameEventDepot.InventorySorted += OnInventorySorted; - gameEventDepot.HealingItemConsumed += OnHealingItemConsumed; - gameEventDepot.TeleportEntered += OnTeleportEntered; - }); - OnDetach(() => - { - var gameEventDepot = Get(); - gameEventDepot.OverworldEntered -= OnOverworldEntered; - gameEventDepot.DungeonAThemeAreaEntered -= OnDungeonAThemeEntered; - gameEventDepot.MenuScrolled -= OnMenuScrolled; - gameEventDepot.MenuBackedOut -= OnMenuBackedOut; - gameEventDepot.EquippedItem -= OnEquippedItem; - gameEventDepot.InventorySorted -= OnInventorySorted; - gameEventDepot.TeleportEntered -= OnTeleportEntered; - }); - } - - private void OnMenuBackedOut() => Output(new Output.PlayMenuBackSound()); - - private void OnHealingItemConsumed(ConsumableItemStats stats) => Output(new Output.PlayHealingItemSound()); - - private void OnInventorySorted() => Output(new Output.PlayInventorySortedSound()); - - private void OnEquippedItem() => Output(new Output.PlayEquipSound()); - - private void OnOverworldEntered() => Output(new Output.PlayOverworldMusic()); - - private void OnDungeonAThemeEntered() => Output(new Output.PlayDungeonThemeAMusic()); - - private void OnMenuScrolled() => Output(new Output.PlayMenuScrollSound()); - - private void OnTeleportEntered() => Output(new Output.PlayTeleportSound()); } } diff --git a/src/audio/state/InGameAudioLogic.cs b/src/audio/state/InGameAudioLogic.cs index 7e6aa5b2..3ac5af24 100644 --- a/src/audio/state/InGameAudioLogic.cs +++ b/src/audio/state/InGameAudioLogic.cs @@ -9,5 +9,5 @@ public interface IInGameAudioLogic : ILogicBlock; public partial class InGameAudioLogic : LogicBlock, IInGameAudioLogic { - public override Transition GetInitialState() => To(); + public override Transition GetInitialState() => To(); } diff --git a/src/audio/state/states/InGameAudioLogic.State.Disabled.cs b/src/audio/state/states/InGameAudioLogic.State.Disabled.cs new file mode 100644 index 00000000..5364daf8 --- /dev/null +++ b/src/audio/state/states/InGameAudioLogic.State.Disabled.cs @@ -0,0 +1,12 @@ +using Chickensoft.Introspection; +using Chickensoft.LogicBlocks; + +namespace GameJamDungeon; + +public partial class InGameAudioLogic +{ + [Meta] + public partial record Disabled : State + { + } +} \ No newline at end of file diff --git a/src/audio/state/states/InGameAudioLogic.State.Enabled.cs b/src/audio/state/states/InGameAudioLogic.State.Enabled.cs new file mode 100644 index 00000000..c7d32bde --- /dev/null +++ b/src/audio/state/states/InGameAudioLogic.State.Enabled.cs @@ -0,0 +1,56 @@ +using Chickensoft.Introspection; +using Chickensoft.LogicBlocks; +using System; + +namespace GameJamDungeon; + +public partial class InGameAudioLogic +{ + [Meta] + public partial record Enabled : State + { + public Enabled() + { + OnAttach(() => + { + OnOverworldEntered(); + var gameEventDepot = Get(); + gameEventDepot.OverworldEntered += OnOverworldEntered; + gameEventDepot.DungeonAThemeAreaEntered += OnDungeonAThemeEntered; + gameEventDepot.MenuScrolled += OnMenuScrolled; + gameEventDepot.MenuBackedOut += OnMenuBackedOut; + gameEventDepot.EquippedItem += OnEquippedItem; + gameEventDepot.InventorySorted += OnInventorySorted; + gameEventDepot.HealingItemConsumed += OnHealingItemConsumed; + gameEventDepot.TeleportEntered += OnTeleportEntered; + }); + OnDetach(() => + { + var gameEventDepot = Get(); + gameEventDepot.OverworldEntered -= OnOverworldEntered; + gameEventDepot.DungeonAThemeAreaEntered -= OnDungeonAThemeEntered; + gameEventDepot.MenuScrolled -= OnMenuScrolled; + gameEventDepot.MenuBackedOut -= OnMenuBackedOut; + gameEventDepot.EquippedItem -= OnEquippedItem; + gameEventDepot.InventorySorted -= OnInventorySorted; + gameEventDepot.TeleportEntered -= OnTeleportEntered; + }); + } + + private void OnMenuBackedOut() => Output(new Output.PlayMenuBackSound()); + + private void OnHealingItemConsumed(ConsumableItemStats stats) => Output(new Output.PlayHealingItemSound()); + + private void OnInventorySorted() => Output(new Output.PlayInventorySortedSound()); + + private void OnEquippedItem() => Output(new Output.PlayEquipSound()); + + private void OnOverworldEntered() => Output(new Output.PlayOverworldMusic()); + + private void OnDungeonAThemeEntered() => Output(new Output.PlayDungeonThemeAMusic()); + + private void OnMenuScrolled() => Output(new Output.PlayMenuScrollSound()); + + private void OnTeleportEntered() => Output(new Output.PlayTeleportSound()); + } +} diff --git a/src/game/Game.cs b/src/game/Game.cs index 23d2433e..b8c5b275 100644 --- a/src/game/Game.cs +++ b/src/game/Game.cs @@ -103,7 +103,6 @@ public partial class Game : Node3D, IGame GameLogic.Start(); GameLogic.Input(new GameLogic.Input.Initialize()); - InGameAudio.OverworldBgm.FadeIn(); this.Provide();