整合SLSUtilities
This commit is contained in:
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.Tools;
|
||||
using System.Collections.Generic;
|
||||
using SLSUtilities.Cinemachine;
|
||||
#if MM_CINEMACHINE
|
||||
using Cinemachine;
|
||||
#elif MM_CINEMACHINE3
|
||||
@@ -62,8 +63,6 @@ namespace MoreMountains.FeedbacksForThirdParty
|
||||
#endif
|
||||
public class MMCinemachineRotationShaker : MMShaker
|
||||
{
|
||||
public Transform FollowTarget => _targetCamera.Follow;
|
||||
|
||||
[MMInspectorGroup("Debug Info", true, 43)]
|
||||
[MMReadOnly]
|
||||
public int ActiveShakesCount = 0;
|
||||
@@ -73,9 +72,9 @@ namespace MoreMountains.FeedbacksForThirdParty
|
||||
#elif MM_CINEMACHINE3
|
||||
protected CinemachineCamera _targetCamera;
|
||||
#endif
|
||||
|
||||
protected float _initialDutch;
|
||||
protected Quaternion _initialTargetRotation;
|
||||
|
||||
protected CinemachineRotationOffset _rotationOffset;
|
||||
protected Vector3 _initialTargetRotation;
|
||||
|
||||
// 活跃震动列表
|
||||
protected List<MMCinemachineRotationShakeInstance> _activeShakes = new List<MMCinemachineRotationShakeInstance>();
|
||||
@@ -85,8 +84,10 @@ namespace MoreMountains.FeedbacksForThirdParty
|
||||
// 不调用 base.Initialization() 以完全接管 Update 逻辑
|
||||
#if MM_CINEMACHINE
|
||||
_targetCamera = GetComponent<CinemachineVirtualCamera>();
|
||||
_rotationOffset = GetComponent<CinemachineRotationOffset>();
|
||||
#elif MM_CINEMACHINE3
|
||||
_targetCamera = GetComponent<CinemachineCamera>();
|
||||
_rotationOffset = GetComponent<CinemachineRotationOffset>();
|
||||
#endif
|
||||
GrabInitialValues();
|
||||
}
|
||||
@@ -95,16 +96,7 @@ namespace MoreMountains.FeedbacksForThirdParty
|
||||
{
|
||||
if (_targetCamera != null)
|
||||
{
|
||||
#if MM_CINEMACHINE
|
||||
_initialDutch = _targetCamera.m_Lens.Dutch;
|
||||
#elif MM_CINEMACHINE3
|
||||
_initialDutch = _targetCamera.Lens.Dutch;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (FollowTarget != null)
|
||||
{
|
||||
_initialTargetRotation = FollowTarget.localRotation;
|
||||
_initialTargetRotation = _rotationOffset.rotationOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,22 +154,7 @@ namespace MoreMountains.FeedbacksForThirdParty
|
||||
|
||||
protected virtual void ApplyRotation(float xOffset, float yOffset, float zOffset)
|
||||
{
|
||||
// Z -> Dutch (直接加法)
|
||||
if (_targetCamera != null)
|
||||
{
|
||||
#if MM_CINEMACHINE
|
||||
_targetCamera.m_Lens.Dutch = _initialDutch + zOffset;
|
||||
#elif MM_CINEMACHINE3
|
||||
_targetCamera.Lens.Dutch = _initialDutch + zOffset;
|
||||
#endif
|
||||
}
|
||||
|
||||
// X/Y -> FollowTarget (Quaternion 乘法)
|
||||
if (FollowTarget != null)
|
||||
{
|
||||
// 注意:这里我们将叠加后的 Euler 角度转换为 Quaternion,然后应用到初始旋转上
|
||||
FollowTarget.localRotation = _initialTargetRotation * Quaternion.Euler(xOffset, yOffset, 0f);
|
||||
}
|
||||
_rotationOffset.rotationOffset = _initialTargetRotation + new Vector3(xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
public virtual void OnMMCinemachineRotationShakeEvent(MMF_Feedback source,
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:457756d89b35d2941b3e7b37b4ece6f1",
|
||||
"GUID:15fc0a57446b3144c949da3e2b9737a9",
|
||||
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
|
||||
"GUID:d60799ab2a985554ea1a39cd38695018",
|
||||
"GUID:57a0b9bc628ab4740af4b6f1f0b2e134",
|
||||
"GUID:d04eb9c554ad44ceab303cecf0c0cf82",
|
||||
"GUID:516a5277b8c3b4f4c8cc86b77b1591ff",
|
||||
"GUID:2bafac87e7f4b9b418d9448d219b01ab"
|
||||
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
|
||||
"GUID:54011f78fe0b65a40902b5084fa563d9"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
Reference in New Issue
Block a user