Files
zeling_v2/Assets/_Game/Scripts/Camera/CameraLensConfigSO.cs
2026-05-17 07:56:12 +08:00

39 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
namespace BaseGames.Camera
{
/// <summary>
/// 全局相机镜头配置。
///
/// 作为 <see cref="CameraStateController"/> 和各 <see cref="CameraArea"/> 之间的
/// 单一参数来源:
/// - Persistent 场景的 <see cref="CameraStateController"/> 在 Awake 时将
/// <see cref="fieldOfView"/> 写入两台全局 VCam 的 Lens。
/// - Room 场景的 <see cref="CameraArea"/> 引用同一 SO编辑器工具在计算限位多边形
/// 时直接读取,无需依赖 Persistent 场景是否已加载。
///
/// 使用方式:
/// 1. Project 窗口右键 → BaseGames/Camera/Lens Config 新建一个 SO 资产。
/// 2. 将该资产同时赋给 CameraStateController._lensConfig 和所有 CameraArea._lensConfig。
/// 3. 修改 <see cref="fieldOfView"/> 后,编辑器会自动重新同步所有已打开场景中的
/// CameraArea 限位多边形。
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/Camera/Lens Config", fileName = "CameraLensConfig")]
public class CameraLensConfigSO : ScriptableObject
{
[Tooltip("全局虚拟相机的垂直 FOV。\n" +
"修改此值后,编辑器会自动对所有已打开场景中的 CameraArea 重新同步限位多边形。\n" +
"运行时由 CameraStateController 在 Awake 时应用到全局 VCam。")]
[Range(1f, 179f)]
public float fieldOfView = 60f;
[Tooltip("摄像机到场景平面Z = 0的垂直距离世界单位。\n" +
"与 fieldOfView 共同决定透视相机的视口尺寸,\n" +
"用于将可视区域VisibleBounds换算为 CinemachineConfiner2D 限位多边形。\n" +
"推荐与 Persistent 场景中相机 Transform 的 |Z| 保持一致(通常为 10。\n" +
"CameraArea._cameraDepth > 0 时以区域专有值优先覆盖此全局值。")]
[Min(0.1f)]
public float cameraDepth = 10f;
}
}