diff --git a/Assets/Scripts/Animation/OpeningFlowController.cs b/Assets/Scripts/Animation/OpeningFlowController.cs index 9e99d0d..81e8a30 100644 --- a/Assets/Scripts/Animation/OpeningFlowController.cs +++ b/Assets/Scripts/Animation/OpeningFlowController.cs @@ -9,21 +9,6 @@ using System.Collections; /// public class OpeningFlowController : MonoBehaviour { - [Header("=== 角色引用 ===")] - [SerializeField] private Animator _manAnimator; - [SerializeField] private Animator _man2Animator; - [SerializeField] private GameObject _man2Object; - [SerializeField] private GameObject _womanObject; - [SerializeField] private GameObject _manInjuryObject; - - [Header("=== 黑幕 UI ===")] - [SerializeField] private GameObject _blackScreenPanel; - [SerializeField] private Image _blackScreenImage; - - [Header("=== 时间配置 ===")] - [SerializeField] private float _idleDuration = 2f; - [SerializeField] private float _fadeDuration = 1f; - private void Start() { // 自动查找引用 @@ -32,7 +17,15 @@ public class OpeningFlowController : MonoBehaviour // 初始状态确认:woman 和 maninjury 应该隐藏 if (_womanObject != null) _womanObject.SetActive(false); if (_manInjuryObject != null) _manInjuryObject.SetActive(false); - if (_blackScreenPanel != null) _blackScreenPanel.SetActive(false); + + // BlackScreenPanel:保持 active,但确保 alpha=0(透明不可见) + if (_blackScreenPanel != null) + { + _blackScreenPanel.SetActive(true); + if (_blackScreenImage != null) + _blackScreenImage.color = new Color(0, 0, 0, 0); + Debug.Log("[OpeningFlow] BlackScreenPanel 已就绪,初始透明"); + } // 不自动启动动画流程 —— 等待用户选择模式和固定方式后由 PageController 触发 Debug.Log("[OpeningFlow] 就绪,等待用户选择模式和固定方式。"); @@ -53,9 +46,32 @@ public class OpeningFlowController : MonoBehaviour if (_womanObject == null) _womanObject = GameObject.Find("woman"); if (_manInjuryObject == null) _manInjuryObject = GameObject.Find("maninjury"); - if (_blackScreenPanel == null) _blackScreenPanel = GameObject.Find("BlackScreenPanel"); - if (_blackScreenImage == null && _blackScreenPanel != null) + + // BlackScreenPanel:先用常规 Find,找不到再用 includeInactive 兜底 + if (_blackScreenPanel == null) + _blackScreenPanel = GameObject.Find("BlackScreenPanel"); + if (_blackScreenPanel == null) + { + // 兜底:搜索非活跃对象 + var allImages = FindObjectsOfType(true); + foreach (var img in allImages) + { + if (img.name == "BlackScreenPanel") + { + _blackScreenPanel = img.gameObject; + _blackScreenImage = img; + Debug.Log("[OpeningFlow] BlackScreenPanel 通过 includeInactive 兜底找到"); + break; + } + } + } + if (_blackScreenPanel != null && _blackScreenImage == null) _blackScreenImage = _blackScreenPanel.GetComponent(); + + if (_blackScreenPanel == null) + Debug.LogWarning("[OpeningFlow] BlackScreenPanel 未找到!黑幕转场将不会显示"); + else + Debug.Log($"[OpeningFlow] BlackScreenPanel 已找到: activeInHierarchy={_blackScreenPanel.activeInHierarchy}, Image={_blackScreenImage != null}"); } ///