Files
Project-M/Assets/_Project/Scripts/Client/Input/AimPresentation.cs
T
2026-06-03 13:46:13 -07:00

22 lines
1.2 KiB
C#

namespace ProjectM.Client
{
/// <summary>
/// Static bridge from the client input gather (which owns active-device detection) to the presentation
/// layer (<see cref="AimReticleSystem"/>), mirroring the <c>PrototypeCameraRig</c> statics idiom. Holds
/// the last detected input scheme so the reticle system can switch the on-screen cursor (mouse
/// crosshair) vs the world reticle (gamepad) without re-deriving raw device state. Process-local and
/// presentation-only — never read by the simulation.
/// </summary>
public static class AimPresentation
{
/// <summary>Active scheme (<see cref="ProjectM.Simulation.InputSchemeId"/>): 0 = mouse/keyboard, 1 = gamepad.</summary>
public static byte Scheme;
// Static fields can survive editor domain reloads (fast enter-play-mode); reset on every play-enter so a
// stale gamepad value from a prior session can't briefly hide the cursor / show the world reticle before
// the input gather republishes the real scheme.
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetOnEnterPlayMode() => Scheme = ProjectM.Simulation.InputSchemeId.KeyboardMouse;
}
}