Fix final chanrao audio, smooth camera3 transition, show TipPanel for 2s, and play tuoxiezi video

This commit is contained in:
yangbear
2026-07-10 02:51:52 +08:00
parent 193d93f852
commit ec503bd3f1
4 changed files with 83 additions and 4 deletions
+49 -3
View File
@@ -98,11 +98,57 @@ public class AudioManager : MonoBehaviour
public void StopVoice() { _voiceSource.Stop(); }
public void SwitchToCamera3()
{
StartCoroutine(SmoothSwitchCameraCoroutine());
}
private System.Collections.IEnumerator SmoothSwitchCameraCoroutine()
{
var cam2 = GameObject.Find("camera2");
var cam3 = GameObject.Find("camera3");
if (cam2 != null) { var c = cam2.GetComponent<Camera>(); if (c != null) c.enabled = false; }
if (cam3 != null) { var c = cam3.GetComponent<Camera>(); if (c != null) c.enabled = true; }
Debug.Log("[AudioManager] camera2→camera3 直接切换完成");
if (cam2 == null || cam3 == null)
{
if (cam2 != null) { var c = cam2.GetComponent<Camera>(); if (c != null) c.enabled = false; }
if (cam3 != null) { var c = cam3.GetComponent<Camera>(); if (c != null) c.enabled = true; }
yield break;
}
var c2 = cam2.GetComponent<Camera>();
var c3 = cam3.GetComponent<Camera>();
if (c2 == null || c3 == null) yield break;
// 保存 camera3 原本的目标位置和旋转
Vector3 targetPos = cam3.transform.position;
Quaternion targetRot = cam3.transform.rotation;
// 将 camera3 放到 camera2 的位置
cam3.transform.position = cam2.transform.position;
cam3.transform.rotation = cam2.transform.rotation;
// 切换激活状态,这样任何挂在 camera3 上的后期特效立刻生效,但视角还没变
c2.enabled = false;
c3.enabled = true;
float duration = 1.0f;
float elapsed = 0f;
while (elapsed < duration)
{
elapsed += Time.deltaTime;
float t = elapsed / duration;
// 加上平滑曲线 (EaseInOut)
t = t * t * (3f - 2f * t);
cam3.transform.position = Vector3.Lerp(cam2.transform.position, targetPos, t);
cam3.transform.rotation = Quaternion.Slerp(cam2.transform.rotation, targetRot, t);
yield return null;
}
cam3.transform.position = targetPos;
cam3.transform.rotation = targetRot;
Debug.Log("[AudioManager] camera2→camera3 平滑过渡完成");
}
}