Sweep over 48 files (Editor/ excluded): remove comments that restate the code, condense class summaries, fix three stale doc statements (HsvColorPicker alpha bar, PaintHud layoutPrefab, MasterVolume FallbackDefault). Inline two single-use wrappers (IsPointerOverUi, BuildModes), drop an unused using, replace a magic literal with the existing ParallaxBase constant, and convert ~10 UnityEngine.Object null checks to the implicit-bool convention. No serialized fields, signatures, RPC/NetworkVariable names, defaults, or #if blocks touched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
/// <summary>
|
|
/// Base class for a high-level game mode handled by <see cref="GameModeManager"/>.
|
|
/// Modes are plain C# classes (not MonoBehaviours); Enter/Exit/Tick are driven
|
|
/// manually by the manager. Derive from this and register an instance in
|
|
/// GameModeManager.BuildModes().
|
|
/// </summary>
|
|
public abstract class GameMode
|
|
{
|
|
protected GameModeManager Manager { get; private set; }
|
|
|
|
/// <summary>Human-readable name (shown in logs).</summary>
|
|
public abstract string DisplayName { get; }
|
|
|
|
internal void Bind(GameModeManager manager) => Manager = manager;
|
|
|
|
/// <summary>Called once when this mode becomes active.</summary>
|
|
public virtual void Enter() { }
|
|
|
|
/// <summary>Called once when this mode stops being active.</summary>
|
|
public virtual void Exit() { }
|
|
|
|
/// <summary>Called every frame while this mode is active.</summary>
|
|
public virtual void Tick() { }
|
|
|
|
/// <summary>Enables the player component and sets whether it accepts movement input.</summary>
|
|
protected void SetPlayerControl(bool controlEnabled)
|
|
{
|
|
if (Manager.Player)
|
|
{
|
|
Manager.Player.enabled = true;
|
|
Manager.Player.ControlEnabled = controlEnabled;
|
|
}
|
|
}
|
|
|
|
protected void SetPainting(bool on)
|
|
{
|
|
if (Manager.Painter)
|
|
Manager.Painter.PaintingEnabled = on;
|
|
}
|
|
|
|
/// <summary>Enables/disables the orbit camera input component. Off while a dedicated camera rig is
|
|
/// live: the orbit rig would otherwise keep grabbing the cursor and reading the mouse every frame.</summary>
|
|
protected void SetOrbitInputEnabled(bool on)
|
|
{
|
|
if (Manager.CameraInput)
|
|
Manager.CameraInput.enabled = on;
|
|
}
|
|
}
|