Introduce an extensible game mode system toggled with Tab: - Player Control: WASD movement with always-on mouse camera orbit - Paint: player frozen, left-click paints, right-click holds to orbit Add GameMode base class, GameModeManager, and the two concrete modes. Refactor controlled scripts to expose clean state flags instead of handling input themselves: ThirdPersonOrbitInput.LookMode, PlayerCharacterController.ControlEnabled, MeshPainter.PaintingEnabled. Also fix camera zoom: remove the obsolete /120 wheel normalization so one scroll notch maps to one zoomSpeed step under the new Input System. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
/// <summary>
|
|
/// Base class for a high-level game mode (state) handled by
|
|
/// <see cref="GameModeManager"/>. A mode configures the relevant scene systems
|
|
/// when it becomes active (<see cref="Enter"/>), can clean up when it is left
|
|
/// (<see cref="Exit"/>) and may run per-frame logic in <see cref="Tick"/>.
|
|
///
|
|
/// Modes are plain C# classes (not MonoBehaviours). To add a new mode, derive
|
|
/// from this class and register an instance in GameModeManager.BuildModes().
|
|
/// </summary>
|
|
public abstract class GameMode
|
|
{
|
|
/// <summary>The owning manager, providing access to the controlled systems.</summary>
|
|
protected GameModeManager Manager { get; private set; }
|
|
|
|
/// <summary>Human-readable name (shown in logs / debug UI).</summary>
|
|
public abstract string DisplayName { get; }
|
|
|
|
/// <summary>Wires the mode to its manager. Called once during registration.</summary>
|
|
internal void Bind(GameModeManager manager) => Manager = manager;
|
|
|
|
/// <summary>Called once when this mode becomes the active mode.</summary>
|
|
public virtual void Enter() { }
|
|
|
|
/// <summary>Called once when this mode stops being the active mode.</summary>
|
|
public virtual void Exit() { }
|
|
|
|
/// <summary>Called every frame while this mode is the active mode.</summary>
|
|
public virtual void Tick() { }
|
|
}
|