fix: Idle缩到1s + 摔倒改用Play直接播放避免被Animator过渡跳过

- Idle从2s缩短到1s
- Fall不再依赖SetBool+Animator过渡,改用Play("manfull")直接播放
- 摔倒后停留2s确保看清
This commit is contained in:
yangbear
2026-06-30 00:52:13 +08:00
parent c8a21fa3b3
commit c1f1428d39
3 changed files with 20 additions and 19 deletions
@@ -94,51 +94,52 @@ public class OpeningFlowController : MonoBehaviour
{
Debug.Log("=== [OpeningFlow] 片头动画流程开始 ===");
// 重置参数,让 Animator 默认进入 Idle(不调用 Play 避免重复触发)
// 重置参数,让 Animator 默认进入 Idle
if (_manAnimator != null)
{
_manAnimator.SetBool("IsStart", false);
_manAnimator.SetBool("IsFull", false);
Debug.Log("[OpeningFlow] man Animator 已重置: IsStart=false, IsFull=false, 默认 Idle");
Debug.Log("[OpeningFlow] man Animator 已重置, 默认 Idle");
}
// Step 1: Idle 2s
Debug.Log($"[OpeningFlow] Step1: man + man2 Idle ({_idleDuration}s)");
yield return new WaitForSeconds(_idleDuration);
// Step 1: Idle 1s
Debug.Log("[OpeningFlow] Step1: man + man2 Idle (1s)");
yield return new WaitForSeconds(1f);
// Step 2: Shoot —— 每帧锁 IsFull=false
Debug.Log("[OpeningFlow] Step2: man Shoot 动画开始");
// Step 2: Shoot (3.15s) —— 每帧锁 IsFull=false
Debug.Log("[OpeningFlow] Step2: man Shoot 开始 (3.15s)");
if (_manAnimator != null)
{
_manAnimator.SetBool("IsFull", false);
_manAnimator.SetBool("IsStart", true);
Debug.Log("[OpeningFlow] man IsStart=true, IsFull=false, 触发 Shoot");
float shootElapsed = 0f;
while (shootElapsed < 3.15f)
float t = 0f;
while (t < 3.15f)
{
shootElapsed += Time.deltaTime;
t += Time.deltaTime;
_manAnimator.SetBool("IsFull", false);
yield return null;
}
// 关键:先设 IsFull=true 再清 IsStart,避免回到 Idle 闪一下
_manAnimator.SetBool("IsFull", true);
_manAnimator.SetBool("IsStart", false);
Debug.Log("[OpeningFlow] man IsStart=false, IsFull=true, 触发 manfull");
Debug.Log("[OpeningFlow] Step2: Shoot 结束");
}
// Step 3: 摔倒 manfull (2.1s) + 看清停留 2s
Debug.Log("[OpeningFlow] Step3: man Fall 动画 (2.1s) + 停留 2s");
// Step 3: 摔倒 —— 直接用 Play 保证播放,不走 Animator 过渡
Debug.Log("[OpeningFlow] Step3: manfall 开始 (直接 Play)");
if (_manAnimator != null)
{
_manAnimator.Play("manfull", 0, 0f);
Debug.Log("[OpeningFlow] manfull 已触发, 等待 2.1s");
}
yield return new WaitForSeconds(2.1f);
Debug.Log("[OpeningFlow] Step3: man Fall 动画结束, 停留 2s 让玩家看清摔倒");
Debug.Log("[OpeningFlow] manfull 播放完成, 停留 2s");
yield return new WaitForSeconds(2f);
// Step 4: 黑幕转场
Debug.Log("[OpeningFlow] Step4: 黑幕转场开始");
yield return StartCoroutine(FadeBlackScreen(0f, 1f));
// 隐藏 man 和 man2,显示 woman 和 maninjury
// 隐藏 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 已显示"); }