引入 Cinemachine 和 CameraModule,添加摄像机跟随缓动效果
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.CameraModule
|
||||
{
|
||||
/// <summary>
|
||||
/// 相机效果配置参数。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct CameraEffectSettings
|
||||
{
|
||||
[Header("跟随缓动 (FollowDamping)")]
|
||||
[Tooltip("X 轴阻尼,值越大跟随后的响应越慢")]
|
||||
[Range(0f, 20f)]
|
||||
public float dampingX;
|
||||
|
||||
[Tooltip("Y 轴阻尼")]
|
||||
[Range(0f, 20f)]
|
||||
public float dampingY;
|
||||
|
||||
[Tooltip("Z 轴阻尼")]
|
||||
[Range(0f, 20f)]
|
||||
public float dampingZ;
|
||||
|
||||
[Header("移动方向偏移 (MovementDirectionOffset)")]
|
||||
[Tooltip("偏移强度系数,值越大偏移越明显")]
|
||||
[Range(0f, 10f)]
|
||||
public float offsetStrength;
|
||||
|
||||
[Tooltip("最大偏移距离(世界单位)")]
|
||||
[Range(0f, 20f)]
|
||||
public float maxOffsetDistance;
|
||||
|
||||
[Tooltip("偏移平滑速度")]
|
||||
[Range(0f, 20f)]
|
||||
public float offsetSmoothing;
|
||||
|
||||
[Tooltip("偏移采样速度低于此值时不产生偏移")]
|
||||
[Range(0f, 5f)]
|
||||
public float offsetDeadZone;
|
||||
|
||||
/// <summary>
|
||||
/// 默认配置:适中的阻尼和偏移参数。
|
||||
/// </summary>
|
||||
public static CameraEffectSettings Default => new CameraEffectSettings
|
||||
{
|
||||
dampingX = 1f,
|
||||
dampingY = 1f,
|
||||
dampingZ = 1f,
|
||||
offsetStrength = 2f,
|
||||
maxOffsetDistance = 3f,
|
||||
offsetSmoothing = 5f,
|
||||
offsetDeadZone = 0.1f,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user