feat: ping/chanrao交互系统 + camera3平滑切换

- PingClickHandler: 蓝色闪烁描边, 点击显示chanrao并隐藏自己, 链式激活下个ping
- ping链: 004→003→002→001 (从4开始)
- TouchPositionHandler: point1点击时黑幕渐入→切camera3→渐出
- PageController: 实验启动时激活ping.004
This commit is contained in:
yangbear
2026-07-02 16:07:02 +08:00
parent 2538eecb6b
commit 393e3da16f
5 changed files with 129 additions and 10 deletions
+6 -9
View File
@@ -3285,11 +3285,14 @@ MonoBehaviour:
m_GameObject: {fileID: 441640509}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a0e43c7217447f9b4be5e2434520e4, type: 3}
m_Script: {fileID: 11500000, guid: 55eccc8daa89f482193b0fcb1aa0f2bc, type: 3}
m_Name:
m_EditorClassIdentifier:
_homeBgClip: {fileID: 0}
_experimentBgClip: {fileID: 0}
_homeBg: {fileID: 8300000, guid: 28a93a41087664f1d9f83a456d17928f, type: 3}
_experimentBg: {fileID: 8300000, guid: 4f431e6ae1b9f4b94a61c31fe630647a, type: 3}
BgVolume: 0.5
_basketballSfx: {fileID: 8300000, guid: 25ff553be9c84452ab0a39fbfd06be77, type: 3}
_manCallSfx: {fileID: 8300000, guid: bc5816d37e79f4461a243f63cd20c925, type: 3}
--- !u!1 &458363765
GameObject:
m_ObjectHideFlags: 0
@@ -9704,12 +9707,6 @@ MonoBehaviour:
_practiceModeDesc: "\u25CF \u6A21\u62DF\u7EC3\u4E60\u6A21\u5F0F\uFF1A\u4E0D\u9650\u65F6\u957F\uFF0C\u53EF\u53CD\u590D\u7EC3\u4E60\u3002\u7CFB\u7EDF\u4E0D\u8BC4\u5206\uFF0C\u5E2E\u52A9\u60A8\u719F\u6089\u5B9E\u9A8C\u6D41\u7A0B\u548C\u64CD\u4F5C\u6B65\u9AA4\u3002"
_examModeDesc: "\u25CF \u8003\u6838\u8BC4\u4F30\u6A21\u5F0F\uFF1A\u9650\u5B9A\u65F6\u95F4\uFF0C\u5B8C\u6210\u540E\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5E76\u63D0\u4F9B\u8BE6\u7EC6\u53CD\u9988\u62A5\u544A\u3002"
_editorPreview: 0
_homeBgClip: {fileID: 8300000, guid: 28a93a41087664f1d9f83a456d17928f, type: 3}
_experimentBgClip: {fileID: 8300000, guid: 4f431e6ae1b9f4b94a61c31fe630647a, type: 3}
_womanClips:
- {fileID: 8300000, guid: 6934b8b2c79df41118a058e984de2a7b, type: 3}
- {fileID: 8300000, guid: 0f561ebe499594da29e31277de2f8a1f, type: 3}
- {fileID: 8300000, guid: 845a704b4410b4393ab9327bfaf9d3ec, type: 3}
--- !u!1 &1654726178
GameObject:
m_ObjectHideFlags: 0
@@ -0,0 +1,60 @@
using UnityEngine;
/// <summary>
/// 挂在每个 ping 对象上。带蓝色闪烁描边,点击后显示对应 chanrao 并隐藏自己。
/// 从 ping.004 开始作为第一个(reverse order)。
/// </summary>
public class PingClickHandler : MonoBehaviour
{
public GameObject chanraoObject;
public GameObject nextPing;
private MeshRenderer _meshRenderer;
void Start()
{
_meshRenderer = GetComponent<MeshRenderer>();
if (_meshRenderer == null) _meshRenderer = GetComponentInChildren<MeshRenderer>();
StartCoroutine(BlinkOutline());
}
void OnEnable()
{
_meshRenderer = GetComponent<MeshRenderer>();
if (_meshRenderer == null) _meshRenderer = GetComponentInChildren<MeshRenderer>();
if (_meshRenderer != null) _meshRenderer.enabled = true;
StopAllCoroutines();
StartCoroutine(BlinkOutline());
}
System.Collections.IEnumerator BlinkOutline()
{
while (true)
{
if (_meshRenderer != null)
_meshRenderer.enabled = !_meshRenderer.enabled;
yield return new WaitForSeconds(0.4f);
}
}
void OnMouseDown()
{
Debug.Log($"[PingClick] {name} 被点击");
if (chanraoObject != null)
{
chanraoObject.SetActive(true);
Debug.Log($"[PingClick] {chanraoObject.name} 已显示");
}
StopAllCoroutines();
if (_meshRenderer != null) _meshRenderer.enabled = false;
gameObject.SetActive(false);
if (nextPing != null)
{
nextPing.SetActive(true);
Debug.Log($"[PingClick] {name} → {nextPing.name} 已激活");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f940d2edab2d44ad98aa707038ce89c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -53,6 +53,10 @@ public class TouchPositionHandler : MonoBehaviour
Debug.Log($"[TouchPosition] 播放语音: {voiceClip.name}");
}
// 点击point1时平滑切换到camera3
if (transform.GetSiblingIndex() == 0)
StartCoroutine(SwitchToCamera3Smooth());
int stepIndex = transform.GetSiblingIndex() + 1;
var sm = FindObjectOfType<StepManager>();
if (sm != null) sm.RecordWomanStep(stepIndex);
@@ -83,4 +87,44 @@ public class TouchPositionHandler : MonoBehaviour
_sharedVoice.clip = voiceClip;
_sharedVoice.Play();
}
System.Collections.IEnumerator SwitchToCamera3Smooth()
{
var black = GameObject.Find("BlackScreenPanel");
var blackImg = black != null ? black.GetComponent<UnityEngine.UI.Image>() : null;
float duration = 0.8f;
// 渐入黑
if (black != null && blackImg != null)
{
black.SetActive(true);
for (float t = 0f; t < duration; t += Time.deltaTime)
{
blackImg.color = new Color(0, 0, 0, t / duration);
yield return null;
}
blackImg.color = Color.black;
}
// 切换摄像机
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("[TouchPosition] camera2→camera3 平滑切换完成");
yield return new WaitForSeconds(0.2f);
// 渐出黑
if (black != null && blackImg != null)
{
for (float t = 0f; t < duration; t += Time.deltaTime)
{
blackImg.color = new Color(0, 0, 0, 1f - t / duration);
yield return null;
}
blackImg.color = new Color(0, 0, 0, 0);
black.SetActive(false);
}
}
}
+8 -1
View File
@@ -281,7 +281,14 @@ public class PageController : MonoBehaviour
}
var touch = GameObject.Find("touchArray");
if (touch != null && touch.transform.childCount > 0) { touch.transform.GetChild(0).gameObject.SetActive(true); Debug.Log("PageController: touchArray/point1 已显示"); }
if (touch != null && touch.transform.childCount > 0) { touch.transform.GetChild(0).gameObject.SetActive(true); Debug.Log("PageController: touchArray/point1 已显示");
// 激活第一个 ping (ping.004)
var mi = GameObject.Find("manInjury");
if (mi != null) {
var ping4 = mi.transform.Find("ping.004");
if (ping4 != null) { ping4.gameObject.SetActive(true); Debug.Log("PageController: ping.004 已激活"); }
} }
var tipPanel = GameObject.Find("TipPanel");
if (tipPanel != null) tipPanel.SetActive(true);