Class CoreModeManager
- Namespace
- MoonBark.GridPlacement.Core.Services.Mode
- Assembly
- MoonBark.GridPlacement.Core.dll
Manages grid placement modes and transitions between them. Service that manages transitions between different grid modes (Place, Paint, Remove, etc.). Encapsulates the core business logic of what happens during a mode switch.
NOTE: This class currently depends on PlacementSystem which has been moved to MoonBark.GridPlacement.ECS. During Phase 3, this will be refactored to use IPlacementCoreService instead.
Responsibility: This is an authoritative service. It does not own the mode state itself (ModeService does), but it is responsible for the *effects* of changing modes (e.g., stopping an active placement when switching to Remove mode).
Architecture: Pure Core implementation with no Godot dependencies. Accepts dependencies via constructor injection, enabling testability and reuse.
public sealed class CoreModeManager
- Inheritance
-
CoreModeManager
- Inherited Members
Constructors
CoreModeManager(IPlacementInputBridge, IPlacementCoreService, IFrameworkLogger)
Creates a new CoreModeManager with the specified dependencies.
public CoreModeManager(IPlacementInputBridge inputBridge, IPlacementCoreService coreService, IFrameworkLogger logger)
Parameters
inputBridgeIPlacementInputBridgecoreServiceIPlacementCoreServiceloggerIFrameworkLogger
Methods
ApplyMode(GridMode)
Applies the specified mode to the system. Manages systemic side effects like starting/stopping placement.
public void ApplyMode(GridMode mode)
Parameters
modeGridMode
CreateWithSubscription(IPlacementInputBridge, IPlacementCoreService, IModeService, IFrameworkLogger)
Creates a CoreModeManager that subscribes to mode change events.
public static (CoreModeManager Manager, Action Cleanup) CreateWithSubscription(IPlacementInputBridge inputBridge, IPlacementCoreService coreService, IModeService modeService, IFrameworkLogger logger)
Parameters
inputBridgeIPlacementInputBridgecoreServiceIPlacementCoreServicemodeServiceIModeServiceloggerIFrameworkLogger