Refine Shose undo back to initial voice, fix video looping and hiding, make TipPanel persistent during opening
This commit is contained in:
@@ -94,6 +94,15 @@ public class OpeningFlowController : MonoBehaviour
|
||||
{
|
||||
Debug.Log($"[OpeningFlow] PlayOpeningFlow() 被调用, enable={_enableOpeningFlow}");
|
||||
|
||||
// 展示 TipPanel,一直保持到切换 camera2
|
||||
var tipPanel = GameObject.Find("TipPanel");
|
||||
if (tipPanel == null)
|
||||
{
|
||||
var allT = Resources.FindObjectsOfTypeAll<Transform>();
|
||||
foreach(var t in allT) { if (t.name == "TipPanel") { tipPanel = t.gameObject; break; } }
|
||||
}
|
||||
if (tipPanel != null) tipPanel.SetActive(true);
|
||||
|
||||
// 再次确保开场隐藏鞋子
|
||||
var shose = GameObject.Find("Shose");
|
||||
if (shose != null) shose.SetActive(false);
|
||||
@@ -168,6 +177,14 @@ public class OpeningFlowController : MonoBehaviour
|
||||
|
||||
private void SwitchToCamera2()
|
||||
{
|
||||
var tipPanel = GameObject.Find("TipPanel");
|
||||
if (tipPanel == null)
|
||||
{
|
||||
var allT = Resources.FindObjectsOfTypeAll<Transform>();
|
||||
foreach(var t in allT) { if (t.name == "TipPanel") { tipPanel = t.gameObject; break; } }
|
||||
}
|
||||
if (tipPanel != null) tipPanel.SetActive(false);
|
||||
|
||||
var cam2Go = GameObject.Find("camera2");
|
||||
if (cam2Go != null) { var c = cam2Go.GetComponent<Camera>(); if (c != null) { c.enabled = true; Debug.Log("[OpeningFlow] camera2 已启用"); } }
|
||||
else Debug.LogWarning("[OpeningFlow] 未找到 camera2");
|
||||
|
||||
@@ -131,6 +131,13 @@ public class PingClickHandler : MonoBehaviour
|
||||
if (finishClip != null) am.PlayVoice(finishClip);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 隐藏视频面板
|
||||
var videoController = FindObjectOfType<VideoController>(true);
|
||||
if (videoController != null)
|
||||
{
|
||||
videoController.StopVideo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +171,50 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
|
||||
if (nextObject != null) nextObject.SetActive(false);
|
||||
|
||||
// --- 恢复相机2、隐藏视频并重新播放语音 ---
|
||||
var videoController = FindObjectOfType<VideoController>(true);
|
||||
if (videoController != null)
|
||||
{
|
||||
videoController.StopVideo();
|
||||
videoController.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
var cam2 = GameObject.Find("camera2");
|
||||
var cam3 = GameObject.Find("camera3");
|
||||
if (cam2 == null)
|
||||
{
|
||||
var allT = Resources.FindObjectsOfTypeAll<Transform>();
|
||||
foreach(var t in allT) { if (t.name == "camera2") { cam2 = t.gameObject; break; } }
|
||||
}
|
||||
if (cam2 != null) { var c = cam2.GetComponent<Camera>(); if (c != null) c.enabled = true; }
|
||||
if (cam3 != null) { var c = cam3.GetComponent<Camera>(); if (c != null) c.enabled = false; }
|
||||
|
||||
var am = FindObjectOfType<AudioManager>();
|
||||
if (am != null)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
var autoClip = UnityEditor.AssetDatabase.LoadAssetAtPath<AudioClip>("Assets/Audio/people/周围环境安全,我是救护志愿者,我可以帮助您吗.mp3");
|
||||
if (autoClip != null)
|
||||
{
|
||||
am.PlayVoice(autoClip);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// 把 woman 重置(取消蹲下)
|
||||
var woman = GameObject.Find("woman");
|
||||
if (woman != null)
|
||||
{
|
||||
var anim = woman.GetComponent<Animator>();
|
||||
if (anim != null)
|
||||
{
|
||||
anim.SetBool("isCrouch", false);
|
||||
|
||||
}
|
||||
// 移回原位?如果最初在某个位置,PageController里有记录。这里只要不穿帮即可
|
||||
}
|
||||
// ----------------------------------------
|
||||
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
|
||||
@@ -451,34 +451,12 @@ public class PageController : MonoBehaviour
|
||||
|
||||
Debug.Log($"PageController: 开始等待 {waitTime} 秒以切换摄像机并激活鞋子");
|
||||
|
||||
// --- 新增:展示 TipPanel 2秒 ---
|
||||
var tipPanel = GameObject.Find("TipPanel");
|
||||
if (tipPanel == null)
|
||||
{
|
||||
var allT = Resources.FindObjectsOfTypeAll<Transform>();
|
||||
foreach(var t in allT) { if (t.name == "TipPanel") { tipPanel = t.gameObject; break; } }
|
||||
}
|
||||
if (tipPanel != null)
|
||||
{
|
||||
tipPanel.SetActive(true);
|
||||
// 这里你可以修改 TipPanel 上的文字,如果不修改,它将保持默认内容
|
||||
// 等待2秒后再隐藏
|
||||
StartCoroutine(HideTipPanelAfterDelay(tipPanel, 2.0f));
|
||||
}
|
||||
// -------------------------------
|
||||
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
|
||||
// 2. 切换到 camera3
|
||||
if (am != null) am.SwitchToCamera3();
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator HideTipPanelAfterDelay(GameObject tipPanel, float delay)
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
if (tipPanel != null) tipPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private void HideShose()
|
||||
{
|
||||
var shose = GameObject.Find("Shose");
|
||||
|
||||
@@ -22,8 +22,12 @@ public class VideoController : MonoBehaviour
|
||||
|
||||
if (_videoPlayer != null)
|
||||
{
|
||||
_videoPlayer.isLooping = true;
|
||||
_videoPlayer.loopPointReached += OnVideoEnd;
|
||||
}
|
||||
|
||||
// 初始隐藏视频面板
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>播放指定视频文件(StreamingAssets/Videos/ 下)</summary>
|
||||
|
||||
Reference in New Issue
Block a user