处理切换状态时的视觉效果
在刚切换状态时fadeout效果使用旧状态,并且只在进入view的时候进行初始化,而不是在切换状态的时候进行初始化
This commit is contained in:
@@ -6,7 +6,6 @@ using DG.Tweening;
|
||||
using Yarn.Unity;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
public class EyeManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
@@ -22,12 +21,16 @@ public class EyeManager : MonoBehaviour
|
||||
{
|
||||
CanImagineColor,
|
||||
CannotImagineColor,
|
||||
EyeDisorder
|
||||
EyeDisorder
|
||||
}
|
||||
public ViewCameraManager cameraManager;
|
||||
|
||||
private IEyeStateEffect eyeStateEffect;
|
||||
|
||||
private IEyeStateEffect oldEyeStateEffect; // 新增的字段
|
||||
|
||||
private bool isFirstSetTargetAfterStateChange=false; // 新增的字段
|
||||
|
||||
private float colorTransitionDuration;
|
||||
|
||||
[SerializeField]
|
||||
@@ -108,11 +111,17 @@ public class EyeManager : MonoBehaviour
|
||||
|
||||
float duration = eyeStateEffect.TransitionDuration;
|
||||
|
||||
if (currentTarget != null)
|
||||
if (isFirstSetTargetAfterStateChange)
|
||||
{
|
||||
oldEyeStateEffect?.ApplyUnfocusedEffect(currentTarget);
|
||||
isFirstSetTargetAfterStateChange = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
eyeStateEffect?.ApplyUnfocusedEffect(currentTarget);
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
//eyeStateEffect?.ApplyUnfocusedEffect(currentTarget);
|
||||
yield return new WaitForSeconds(duration);
|
||||
|
||||
cameraManager.MoveCameraTo(target.targetTransform, 1f);
|
||||
yield return new WaitForSeconds(1f);
|
||||
@@ -146,6 +155,9 @@ public class EyeManager : MonoBehaviour
|
||||
// Cleanup current state effect
|
||||
eyeStateEffect?.CleanupEffect(currentTarget);
|
||||
|
||||
// 保存旧的状态
|
||||
oldEyeStateEffect = eyeStateEffect;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case EyeState.CanImagineColor:
|
||||
@@ -163,9 +175,13 @@ public class EyeManager : MonoBehaviour
|
||||
|
||||
// Update transition duration
|
||||
colorTransitionDuration = eyeStateEffect.TransitionDuration;
|
||||
|
||||
// Initialize new state effect
|
||||
isFirstSetTargetAfterStateChange = true;
|
||||
}
|
||||
public void InitializeEyeEffect()
|
||||
{
|
||||
// Initialize new state effect
|
||||
eyeStateEffect.InitializeEffect(currentTarget, cameraManager);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class EyeTransitionManager : MonoBehaviour
|
||||
public MemoryProcess memoryProcess;
|
||||
|
||||
public LineManager lineManager; // LineManager的引用
|
||||
|
||||
public EyeManager eyeManager; // LineManager的引用
|
||||
// 视图配置类
|
||||
[System.Serializable]
|
||||
public class ViewConfig
|
||||
@@ -236,6 +236,7 @@ public class EyeTransitionManager : MonoBehaviour
|
||||
[YarnCommand("start_transition")]
|
||||
public IEnumerator StartTransitionCoroutine(string targetViewStateName)
|
||||
{
|
||||
eyeManager.InitializeEyeEffect();
|
||||
ViewState targetViewState;
|
||||
if (!Enum.TryParse(targetViewStateName, out targetViewState))
|
||||
{
|
||||
|
||||
@@ -9442,6 +9442,7 @@ MonoBehaviour:
|
||||
blackScreenImage: {fileID: 783911289}
|
||||
memoryProcess: {fileID: 1617403347}
|
||||
lineManager: {fileID: 1182811776}
|
||||
eyeManager: {fileID: 271919487}
|
||||
viewConfigs:
|
||||
- viewPanel: {fileID: 1229487019}
|
||||
activateButton: {fileID: 1887941707}
|
||||
|
||||
@@ -25,7 +25,7 @@ position: 63,-958
|
||||
<<declare $EyeUF = false>>
|
||||
<<indoor>>
|
||||
<<load_scene 佩佩视觉模块>>
|
||||
<<jump Test2>>
|
||||
<<jump Treatment>>
|
||||
<<jump OutDoorTalk>>
|
||||
|
||||
===
|
||||
|
||||
Reference in New Issue
Block a user