fix: 去掉 Play(manIdle) 避免 Idle 重复触发 + Shoot→Fall 过渡优化 + 场景 maninjury→manInjury
- 不再调用 Play("manIdle"),仅重置参数让 Animator 默认进入 Idle
- Shoot 结束后先设 IsFull=true 再清 IsStart=false,避免过渡时闪回 Idle
- 摔倒后停留从1s增加到2s,确保玩家看清摔倒动作
- GameObject.Find("maninjury") → Find("manInjury") 匹配场景重命名
This commit is contained in:
@@ -57,7 +57,7 @@ public class OpeningFlowController : MonoBehaviour
|
||||
}
|
||||
|
||||
if (_womanObject == null) _womanObject = GameObject.Find("woman");
|
||||
if (_manInjuryObject == null) _manInjuryObject = GameObject.Find("maninjury");
|
||||
if (_manInjuryObject == null) _manInjuryObject = GameObject.Find("manInjury");
|
||||
|
||||
if (_blackScreenPanel == null)
|
||||
_blackScreenPanel = GameObject.Find("BlackScreenPanel");
|
||||
@@ -94,24 +94,25 @@ public class OpeningFlowController : MonoBehaviour
|
||||
{
|
||||
Debug.Log("=== [OpeningFlow] 片头动画流程开始 ===");
|
||||
|
||||
// 重置参数,让 Animator 默认进入 Idle(不调用 Play 避免重复触发)
|
||||
if (_manAnimator != null)
|
||||
{
|
||||
_manAnimator.SetBool("IsStart", false);
|
||||
_manAnimator.SetBool("IsFull", false);
|
||||
_manAnimator.Play("manIdle", 0, 0f);
|
||||
Debug.Log("[OpeningFlow] man Animator 已重置: IsStart=false, IsFull=false, 强制播放 manIdle");
|
||||
Debug.Log("[OpeningFlow] man Animator 已重置: IsStart=false, IsFull=false, 默认 Idle");
|
||||
}
|
||||
|
||||
// Step 1: Idle 2s
|
||||
Debug.Log($"[OpeningFlow] Step1: man + man2 Idle ({_idleDuration}s)");
|
||||
yield return new WaitForSeconds(_idleDuration);
|
||||
|
||||
// Step 2: Shoot —— 每帧强制 IsFull=false 防止 Animator 中途切走
|
||||
// Step 2: Shoot —— 每帧锁定 IsFull=false
|
||||
Debug.Log("[OpeningFlow] Step2: man Shoot 动画开始");
|
||||
if (_manAnimator != null)
|
||||
{
|
||||
_manAnimator.SetBool("IsFull", false);
|
||||
_manAnimator.SetBool("IsStart", true);
|
||||
Debug.Log("[OpeningFlow] man IsStart=true, IsFull=false, 触发 Shoot,每帧锁定 IsFull=false");
|
||||
Debug.Log("[OpeningFlow] man IsStart=true, IsFull=false, 触发 Shoot");
|
||||
|
||||
float shootElapsed = 0f;
|
||||
while (shootElapsed < 3.15f)
|
||||
@@ -120,22 +121,20 @@ public class OpeningFlowController : MonoBehaviour
|
||||
_manAnimator.SetBool("IsFull", false);
|
||||
yield return null;
|
||||
}
|
||||
_manAnimator.SetBool("IsStart", false);
|
||||
Debug.Log("[OpeningFlow] Step2: man Shoot 动画结束");
|
||||
}
|
||||
|
||||
// Step 3: 摔倒 —— manfull 2.1s + 停留1s
|
||||
Debug.Log("[OpeningFlow] Step3: man Fall 动画开始");
|
||||
if (_manAnimator != null)
|
||||
{
|
||||
// 关键:先设 IsFull=true 再清 IsStart,避免回到 Idle 闪一下
|
||||
_manAnimator.SetBool("IsFull", true);
|
||||
Debug.Log("[OpeningFlow] man IsFull=true, 触发 manfull (2.1s)");
|
||||
yield return new WaitForSeconds(2.1f);
|
||||
Debug.Log("[OpeningFlow] Step3: man Fall 动画结束, 停留1s");
|
||||
yield return new WaitForSeconds(1f);
|
||||
_manAnimator.SetBool("IsStart", false);
|
||||
Debug.Log("[OpeningFlow] man IsStart=false, IsFull=true, 触发 manfull");
|
||||
}
|
||||
|
||||
// Step 4: 黑幕转场 —— 渐入 -> 切换角色+摄像机 -> 渐出
|
||||
// Step 3: 摔倒 manfull (2.1s) + 看清停留 2s
|
||||
Debug.Log("[OpeningFlow] Step3: man Fall 动画 (2.1s) + 停留 2s");
|
||||
yield return new WaitForSeconds(2.1f);
|
||||
Debug.Log("[OpeningFlow] Step3: man Fall 动画结束, 停留 2s 让玩家看清摔倒");
|
||||
yield return new WaitForSeconds(2f);
|
||||
|
||||
// Step 4: 黑幕转场
|
||||
Debug.Log("[OpeningFlow] Step4: 黑幕转场开始");
|
||||
yield return StartCoroutine(FadeBlackScreen(0f, 1f));
|
||||
|
||||
@@ -143,7 +142,7 @@ public class OpeningFlowController : MonoBehaviour
|
||||
if (_manAnimator != null) { _manAnimator.gameObject.SetActive(false); Debug.Log("[OpeningFlow] man 已隐藏"); }
|
||||
if (_man2Object != null) { _man2Object.SetActive(false); Debug.Log("[OpeningFlow] man2 已隐藏"); }
|
||||
if (_womanObject != null) { _womanObject.SetActive(true); Debug.Log("[OpeningFlow] woman 已显示"); }
|
||||
if (_manInjuryObject != null) { _manInjuryObject.SetActive(true); Debug.Log("[OpeningFlow] maninjury 已显示"); }
|
||||
if (_manInjuryObject != null) { _manInjuryObject.SetActive(true); Debug.Log("[OpeningFlow] manInjury 已显示"); }
|
||||
|
||||
SwitchToCamera2();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user