fix: 去掉Shoot的while循环,改为纯WaitForSeconds避免干扰Animator

用户已修复Animator Controller中Shoot循环问题,代码端不再需要每帧SetBool(IsFull,false)
This commit is contained in:
yangbear
2026-06-30 00:57:32 +08:00
parent c1f1428d39
commit 1cd201da60
4 changed files with 91 additions and 91 deletions
@@ -94,7 +94,7 @@ public class OpeningFlowController : MonoBehaviour
{
Debug.Log("=== [OpeningFlow] 片头动画流程开始 ===");
// 重置参数,让 Animator 默认进入 Idle
// 重置参数,默认 Idle
if (_manAnimator != null)
{
_manAnimator.SetBool("IsStart", false);
@@ -106,30 +106,26 @@ public class OpeningFlowController : MonoBehaviour
Debug.Log("[OpeningFlow] Step1: man + man2 Idle (1s)");
yield return new WaitForSeconds(1f);
// Step 2: Shoot (3.15s) —— 每帧锁 IsFull=false
// Step 2: Shoot 3.15s
Debug.Log("[OpeningFlow] Step2: man Shoot 开始 (3.15s)");
if (_manAnimator != null)
{
_manAnimator.SetBool("IsFull", false);
_manAnimator.SetBool("IsStart", true);
float t = 0f;
while (t < 3.15f)
{
t += Time.deltaTime;
_manAnimator.SetBool("IsFull", false);
yield return null;
}
Debug.Log("[OpeningFlow] man IsStart=true, 等待 Shoot 播完");
}
yield return new WaitForSeconds(3.15f);
if (_manAnimator != null)
{
_manAnimator.SetBool("IsStart", false);
Debug.Log("[OpeningFlow] Step2: Shoot 结束");
}
// Step 3: 摔倒 —— 直接 Play 保证播放,不走 Animator 过渡
Debug.Log("[OpeningFlow] Step3: manfall 开始 (直接 Play)");
// Step 3: 摔倒 manfull —— 直接 Play 不走过渡
Debug.Log("[OpeningFlow] Step3: manfall 开始");
if (_manAnimator != null)
{
_manAnimator.Play("manfull", 0, 0f);
Debug.Log("[OpeningFlow] manfull 已触发, 等待 2.1s");
Debug.Log("[OpeningFlow] manfull Play 已触发");
}
yield return new WaitForSeconds(2.1f);
Debug.Log("[OpeningFlow] manfull 播放完成, 停留 2s");
@@ -139,7 +135,6 @@ public class OpeningFlowController : MonoBehaviour
Debug.Log("[OpeningFlow] Step4: 黑幕转场开始");
yield return StartCoroutine(FadeBlackScreen(0f, 1f));
// 隐藏 man 和 man2,显示 woman 和 manInjury
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 已显示"); }