55e98a9275
The byte-identical ResolveCamera() (Camera.main -> PrototypeCameraRig fallback) in PlayerInputGatherSystem, BuildSendSystem, and AimReticleSystem now call one CameraResolver.Resolve(); camera-resolution policy lives in one place. Behaviour-identical; compiles clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
810 B
C#
22 lines
810 B
C#
namespace ProjectM.Client
|
|
{
|
|
/// <summary>
|
|
/// Resolves the gameplay camera for the client systems that cursor-raycast against the ground (input aim,
|
|
/// build placement, aim reticle): <see cref="UnityEngine.Camera.main"/>, falling back to the
|
|
/// <see cref="PrototypeCameraRig"/>'s Camera. Single source so the camera-resolution policy lives in one place.
|
|
/// </summary>
|
|
public static class CameraResolver
|
|
{
|
|
public static UnityEngine.Camera Resolve()
|
|
{
|
|
var cam = UnityEngine.Camera.main;
|
|
if (cam == null)
|
|
{
|
|
var rig = UnityEngine.Object.FindAnyObjectByType<PrototypeCameraRig>();
|
|
if (rig != null) cam = rig.GetComponent<UnityEngine.Camera>();
|
|
}
|
|
return cam;
|
|
}
|
|
}
|
|
}
|