♻️ Rebuild with DI

This commit is contained in:
2025-08-31 01:44:18 +08:00
parent 1cc941d893
commit c72353716f
13 changed files with 95 additions and 36 deletions

View File

@@ -8,9 +8,9 @@ namespace AceFieldNewHorizon.Scripts.System;
public partial class PlacementManager : Node2D
{
[Export] public GridManager Grid { get; set; }
[Export] public ResourceManager Inventory { get; set; }
[Export] public BuildingRegistry Registry { get; set; }
public GridManager Grid { get; private set; }
public ResourceManager Inventory { get; private set; }
public BuildingRegistry Registry { get; private set; }
[Export] public int MaxConcurrentBuilds { get; set; } = 6; // Make it adjustable in editor
[Export] public bool Enabled { get; set; } = true;
@@ -30,6 +30,10 @@ public partial class PlacementManager : Node2D
{
base._Ready();
Grid = DependencyInjection.Container.GetInstance<GridManager>();
Inventory = DependencyInjection.Container.GetInstance<ResourceManager>();
Registry = DependencyInjection.Container.GetInstance<BuildingRegistry>();
// Setup completion sound
_completionSound = CreateAudioPlayer("res://Sounds/Events/ConstructionComplete.wav");
_buildingSound = CreateAudioPlayer("res://Sounds/Events/Building.wav");