Reduce comments to non-obvious "why" notes and convert UnityEngine.Object null checks to implicit bool (if (obj) / if (!obj)). Input System devices (Mouse.current, Keyboard.current) and plain arrays keep explicit != null. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
906 B
C#
25 lines
906 B
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() { }
|
|
}
|