Add audio and particle services, update GamePresenter for game state management

This commit is contained in:
2025-10-30 03:24:51 +01:00
parent c373ed4953
commit 90d3abd83f
4 changed files with 86 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ using GameCore.Logging.Interfaces;
using GameCore.Logic;
using GameCore.Movement;
using GameCore.Player;
using GameCore.State;
using Godot;
namespace CryptonymThunder.Code.Presenters;
@@ -36,6 +37,8 @@ public partial class GamePresenter : Node
private GodotInputService _inputService;
private GodotWorldQuery _worldQuery;
private PresenterFactory _presenterFactory;
private GodotAudioService _audioService;
private GodotParticleService _particleService;
private ILogger _logger = new NullLogger();
private readonly Dictionary<int, List<IPresenterComponent>> _presenterComponents = new();
@@ -46,6 +49,8 @@ public partial class GamePresenter : Node
_presenterRegistry = GetNode<PresenterRegistry>("/root/PresenterRegistry");
_inputService = new GodotInputService();
_worldQuery = new GodotWorldQuery(this);
_audioService = new GodotAudioService();
_particleService = new GodotParticleService();
var simConfig = new SimulationConfig();
if (SimulationConfig != null)
@@ -61,7 +66,7 @@ public partial class GamePresenter : Node
}
}
_world = new World(_inputService, _worldQuery, simConfig, _logger);
_world = new World(_inputService, _worldQuery, simConfig, _logger, _audioService, _particleService);
var effectFactory = new EffectFactory();
var requirementFactory = new InteractionRequirementFactory();
@@ -116,6 +121,7 @@ public partial class GamePresenter : Node
public override void _PhysicsProcess(double delta)
{
if (_world.GameState.CurrentStatus != GameStatus.InGame) return;
if (_presenters.Count == 0) return;
_inputService.Update();
@@ -198,4 +204,9 @@ public partial class GamePresenter : Node
disposableLogger.Dispose();
}
}
public void OnPauseButtonPressed()
{
_world.GameState.SetStatus(GameStatus.Paused);
}
}