多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using Unity.Cinemachine;
using BaseGames.Core;
namespace BaseGames.Camera
{
@@ -9,10 +10,8 @@ namespace BaseGames.Camera
/// 须放置在持久化场景中。
/// </summary>
[DefaultExecutionOrder(-100)]
public class CameraStateController : MonoBehaviour
public class CameraStateController : MonoBehaviour, ICameraService
{
public static CameraStateController Instance { get; private set; }
[Header("引用")]
[SerializeField] private CinemachineBrain _brain;
[SerializeField] private CinemachineImpulseSource _impulseSource;
@@ -27,17 +26,13 @@ namespace BaseGames.Camera
// ── Unity Lifecycle ───────────────────────────────────────────────────
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
if (ServiceLocator.GetOrDefault<ICameraService>() != null) { Destroy(gameObject); return; }
ServiceLocator.Register<ICameraService>(this);
}
private void OnDestroy()
{
if (Instance == this) Instance = null;
ServiceLocator.Unregister<ICameraService>(this);
}
// ── 公开 API ──────────────────────────────────────────────────────────