Refactor more stuff (Audio mostly)

This commit is contained in:
2025-03-10 20:52:39 -07:00
parent 23049b3231
commit a1c26ed7fb
45 changed files with 861 additions and 846 deletions

View File

@@ -53,8 +53,6 @@ public partial class Game : Node3D, IGame
[Node] private IPauseMenu PauseMenu { get; set; } = default!;
[Node] private InGameAudio InGameAudio { get; set; } = default!;
[Node] private Timer DoubleEXPTimer { get; set; } = default!;
[Node] private IPlayer Player { get; set; } = default!;
@@ -218,7 +216,7 @@ public partial class Game : Node3D, IGame
DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout;
_effectService = new EffectService(this, Player);
_effectService = new EffectService(this, Player, Map);
}
public void LoadExistingGame()
@@ -401,8 +399,8 @@ public partial class Game : Node3D, IGame
GameLogic.Input(new GameLogic.Input.SaveGame());
}
private void GameEventDepot_RestorativePickedUp(Restorative obj)
=> Player.Stats.SetCurrentVT(Player.Stats.CurrentVT.Value + obj.VTRestoreAmount);
private void GameEventDepot_RestorativePickedUp(IHealthPack obj)
=> Player.Stats.SetCurrentVT(Player.Stats.CurrentVT.Value + (int)obj.RestoreAmount);
private void SetPauseMode(bool isPaused)
{

View File

@@ -1,43 +1,8 @@
using Godot;
using System;
using Zennysoft.Game.Abstractions;
namespace Zennysoft.Game.Ma;
public interface IGameEventDepot : IDisposable
{
event Action? OverworldEntered;
public void OnOverworldEntered();
event Action? DungeonAThemeAreaEntered;
public void OnDungeonAThemeAreaEntered();
event Action? DungeonBThemeAreaEntered;
public void OnDungeonBThemeAreaEntered();
event Action? DungeonCThemeAreaEntered;
public void OnDungeonCThemeAreaEntered();
event Action? TeleportEntered;
public void OnTeleportEntered();
event Action? MenuScrolled;
public void OnMenuScrolled();
event Action? MenuBackedOut;
public void OnMenuBackedOut();
event Action? InventorySorted;
public void OnInventorySorted();
event Action<ConsumableItemStats>? HealingItemConsumed;
public void OnHealingItemConsumed(ConsumableItemStats item);
event Action<Vector3, EnemyStatResource>? EnemyDefeated;
public void OnEnemyDefeated(Vector3 position, EnemyStatResource enemyStatResource);
event Action<Restorative>? RestorativePickedUp;
public void OnRestorativePickedUp(Restorative restorative);
}
namespace Zennysoft.Ma.Adapter;
public class GameEventDepot : IGameEventDepot
{
@@ -52,10 +17,8 @@ public class GameEventDepot : IGameEventDepot
public event Action? MenuScrolled;
public event Action? MenuBackedOut;
public event Action? InventorySorted;
public event Action<ConsumableItemStats>? HealingItemConsumed;
public event Action<Restorative>? RestorativePickedUp;
public event Action<Vector3, EnemyStatResource>? EnemyDefeated;
public event Action<InventoryItem>? HealingItemConsumed;
public event Action<IHealthPack>? RestorativePickedUp;
public void OnOverworldEntered() => OverworldEntered?.Invoke();
public void OnDungeonAThemeAreaEntered() => DungeonAThemeAreaEntered?.Invoke();
@@ -68,10 +31,8 @@ public class GameEventDepot : IGameEventDepot
public void OnMenuBackedOut() => MenuBackedOut?.Invoke();
public void OnInventorySorted() => InventorySorted?.Invoke();
public void OnHealingItemConsumed(ConsumableItemStats item) => HealingItemConsumed?.Invoke(item);
public void OnRestorativePickedUp(Restorative restorative) => RestorativePickedUp?.Invoke(restorative);
public void OnEnemyDefeated(Vector3 position, EnemyStatResource enemyStatResource) => EnemyDefeated?.Invoke(position, enemyStatResource);
public void OnHealingItemConsumed(InventoryItem item) => HealingItemConsumed?.Invoke(item);
public void OnRestorativePickedUp(IHealthPack restorative) => RestorativePickedUp?.Invoke(restorative);
public void Dispose()
{