diff --git a/Zennysoft.Game.Ma/src/audio/InGameAudio.cs b/Zennysoft.Game.Ma/src/audio/InGameAudio.cs index 0aca0f16..aa6fb9d5 100644 --- a/Zennysoft.Game.Ma/src/audio/InGameAudio.cs +++ b/Zennysoft.Game.Ma/src/audio/InGameAudio.cs @@ -4,7 +4,6 @@ using Chickensoft.Introspection; using Godot; using Zennysoft.Game.Abstractions; using Zennysoft.Ma.Adapter; -using Zennysoft.Ma.Adapter; namespace Zennysoft.Game.Ma; @@ -56,85 +55,85 @@ public partial class InGameAudio : Node public void Setup() { - InGameAudioLogic = new InGameAudioLogic(); + InGameAudioLogic = new InGameAudioLogic(); } public void OnResolved() { - InGameAudioLogic.Set(AppRepo); - InGameAudioLogic.Set(GameEventDepot); - InGameAudioLogic.Set(Player); - InGameAudioLogic.Set(GameRepo); + InGameAudioLogic.Set(AppRepo); + InGameAudioLogic.Set(GameEventDepot); + InGameAudioLogic.Set(Player); + InGameAudioLogic.Set(GameRepo); - InGameAudioBinding = InGameAudioLogic.Bind(); + InGameAudioBinding = InGameAudioLogic.Bind(); - InGameAudioBinding - .Handle((in InGameAudioLogic.Output.PlayOverworldMusic _) => StartOverworldMusic()) - .Handle((in InGameAudioLogic.Output.PlayDungeonThemeAMusic _) => StartDungeonThemeA()) - .Handle((in InGameAudioLogic.Output.PlayMenuScrollSound _) => PlayMenuScrollSound()) - .Handle((in InGameAudioLogic.Output.PlayEquipSound _) => PlayEquipSound()) - .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.PlayPlayerAttackSound _) => { PlayerAttackSFX.Stop(); PlayerAttackSFX.Play(); }) - .Handle((in InGameAudioLogic.Output.PlayPlayerAttackWallSound _) => { PlayerAttackWallSFX.Stop(); PlayerAttackWallSFX.Play(); }); + InGameAudioBinding + .Handle((in InGameAudioLogic.Output.PlayOverworldMusic _) => StartOverworldMusic()) + .Handle((in InGameAudioLogic.Output.PlayDungeonThemeAMusic _) => StartDungeonThemeA()) + .Handle((in InGameAudioLogic.Output.PlayMenuScrollSound _) => PlayMenuScrollSound()) + .Handle((in InGameAudioLogic.Output.PlayEquipSound _) => PlayEquipSound()) + .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.PlayPlayerAttackSound _) => { PlayerAttackSFX.Stop(); PlayerAttackSFX.Play(); }) + .Handle((in InGameAudioLogic.Output.PlayPlayerAttackWallSound _) => { PlayerAttackWallSFX.Stop(); PlayerAttackWallSFX.Play(); }); - InGameAudioLogic.Start(); + InGameAudioLogic.Start(); } public void OnExitTree() { - InGameAudioLogic.Stop(); - InGameAudioBinding.Dispose(); + InGameAudioLogic.Stop(); + InGameAudioBinding.Dispose(); } private void StartOverworldMusic() { - OverworldBgm.Stop(); - OverworldBgm.FadeIn(); + OverworldBgm.Stop(); + OverworldBgm.FadeIn(); } private void StartDungeonThemeA() { - OverworldBgm.FadeOut(); - DungeonThemeABgm.Stop(); - DungeonThemeABgm.FadeIn(); + OverworldBgm.FadeOut(); + DungeonThemeABgm.Stop(); + DungeonThemeABgm.FadeIn(); } private void PlayMenuScrollSound() { - MenuScrollSFX.Stop(); - MenuScrollSFX.Play(); + MenuScrollSFX.Stop(); + MenuScrollSFX.Play(); } private void PlayEquipSound() { - EquipSFX.Stop(); - EquipSFX.Play(); + EquipSFX.Stop(); + EquipSFX.Play(); } private void PlayMenuBackSound() { - MenuBackSFX.Stop(); - MenuBackSFX.Play(); + MenuBackSFX.Stop(); + MenuBackSFX.Play(); } private void PlayInventorySortedSound() { - InventorySortedSFX.Stop(); - InventorySortedSFX.Play(); + InventorySortedSFX.Stop(); + InventorySortedSFX.Play(); } private void PlayHealingItemSound() { - HealingItemSFX.Stop(); - HealingItemSFX.Play(); + HealingItemSFX.Stop(); + HealingItemSFX.Play(); } private void PlayTeleportSound() { - TeleportSFX.Stop(); - TeleportSFX.Play(); + TeleportSFX.Stop(); + TeleportSFX.Play(); } } diff --git a/Zennysoft.Game.Ma/src/game/Game.cs b/Zennysoft.Game.Ma/src/game/Game.cs index 3de4f377..4d730a40 100644 --- a/Zennysoft.Game.Ma/src/game/Game.cs +++ b/Zennysoft.Game.Ma/src/game/Game.cs @@ -25,6 +25,8 @@ public partial class Game : Node3D, IGame IGameEventDepot IProvide.Value() => GameEventDepot; + IMap IProvide.Value() => Map; + private static SimpleInjector.Container _container; public IInstantiator Instantiator { get; set; } = default!; diff --git a/Zennysoft.Game.Ma/src/game/IGame.cs b/Zennysoft.Game.Ma/src/game/IGame.cs index edb9e342..e81129af 100644 --- a/Zennysoft.Game.Ma/src/game/IGame.cs +++ b/Zennysoft.Game.Ma/src/game/IGame.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Zennysoft.Game.Abstractions; using Zennysoft.Ma.Adapter; -public interface IGame : IProvide, IProvide, IProvide, IProvide, IProvide>, INode3D +public interface IGame : IProvide, IProvide, IProvide, IProvide, IProvide, IProvide>, INode3D { void LoadExistingGame(); diff --git a/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs b/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs index 8fc1ee6d..6b650a4d 100644 --- a/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs +++ b/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs @@ -28,6 +28,8 @@ public partial class InventoryMenu : Control, IInventoryMenu [Dependency] public IPlayer Player => this.DependOn(); + [Dependency] public IMap _map => this.DependOn(); + [Dependency] public IGameEventDepot GameEventDepot => this.DependOn(); private InventoryPageNumber _currentPageNumber = InventoryPageNumber.FirstPage; @@ -245,8 +247,7 @@ public partial class InventoryMenu : Control, IInventoryMenu private void PopulatePlayerInfo() { - // TODO: Fix - FloorLabel.Text = $"Floor 01"; + FloorLabel.Text = $"Floor {_map.CurrentFloorNumber:D2}"; if (ItemSlots.Any()) { diff --git a/Zennysoft.Game.Ma/src/map/Map.cs b/Zennysoft.Game.Ma/src/map/Map.cs index 20e8dfa0..11f30dbe 100644 --- a/Zennysoft.Game.Ma/src/map/Map.cs +++ b/Zennysoft.Game.Ma/src/map/Map.cs @@ -22,6 +22,8 @@ public interface IMap : INode3D, IProvide> Transform3D GetPlayerSpawnPosition(); IDungeonRoom GetPlayersCurrentRoom(); + + public int CurrentFloorNumber { get; } } @@ -52,6 +54,8 @@ public partial class Map : Node3D, IMap public IDungeonFloor CurrentFloor { get; private set; } + public int CurrentFloorNumber { get; private set; } = 0; + public void OnResolved() { FloorScenes = []; @@ -95,6 +99,7 @@ public partial class Map : Node3D, IMap Player.TeleportPlayer(transform); CurrentFloor.FloorIsLoaded = true; Game.NextFloorLoaded(); + CurrentFloorNumber += 1; } public IDungeonRoom GetPlayersCurrentRoom() diff --git a/Zennysoft.Game.Ma/src/traits/IKillable.cs b/Zennysoft.Game.Ma/src/traits/IKillable.cs deleted file mode 100644 index 308af4e4..00000000 --- a/Zennysoft.Game.Ma/src/traits/IKillable.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Zennysoft.Game.Abstractions; - -public interface IKillable -{ - public void Die(); -} diff --git a/Zennysoft.Game.Ma/src/traits/IKillable.cs.uid b/Zennysoft.Game.Ma/src/traits/IKillable.cs.uid deleted file mode 100644 index 43da3409..00000000 --- a/Zennysoft.Game.Ma/src/traits/IKillable.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://djmmgvqb2rcde