From 2bb79e452eafa438b92ecf6a49737279fbe36f30 Mon Sep 17 00:00:00 2001 From: yangbear Date: Tue, 30 Jun 2026 02:24:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20touchArray=20=E8=93=9D=E6=8F=8F?= =?UTF-8?q?=E8=BE=B9=20+=20=E9=A1=BA=E5=BA=8F=E6=98=BE=E7=A4=BA(=E7=82=B9?= =?UTF-8?q?=E5=87=BB1=E2=86=922=E2=86=923)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TouchPositionHandler: Start()创建LineRenderer蓝圈描边 - 新增 nextTouchObject 字段实现链式顺序显示 - 点击球体→移动woman→隐藏自己→显示下一个 - 场景初始: 仅point1活跃, 链: point1→point2→point3→null --- .../Interaction/TouchPositionHandler.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Assets/Scripts/Interaction/TouchPositionHandler.cs b/Assets/Scripts/Interaction/TouchPositionHandler.cs index 17b2ec1..2181811 100644 --- a/Assets/Scripts/Interaction/TouchPositionHandler.cs +++ b/Assets/Scripts/Interaction/TouchPositionHandler.cs @@ -8,9 +8,45 @@ public class TouchPositionHandler : MonoBehaviour { public Transform targetPosition; public GameObject womanObject; + public GameObject nextTouchObject; + + private void Start() + { + CreateBlueOutline(); + } + + private void CreateBlueOutline() + { + // 用 LineRenderer 画一个水平圆环描边 + var ringGo = new GameObject("BlueRing"); + ringGo.transform.SetParent(transform, false); + ringGo.transform.localPosition = Vector3.zero; + ringGo.transform.localRotation = Quaternion.Euler(90f, 0, 0); // XZ 平面 + + var lr = ringGo.AddComponent(); + lr.useWorldSpace = false; + lr.loop = true; + lr.startWidth = 0.02f; + lr.endWidth = 0.02f; + lr.material = new Material(Shader.Find("Sprites/Default")); + lr.startColor = Color.blue; + lr.endColor = Color.blue; + + float r = 0.12f; + int segs = 32; + lr.positionCount = segs; + for (int i = 0; i < segs; i++) + { + float a = i * 2f * Mathf.PI / segs; + lr.SetPosition(i, new Vector3(Mathf.Cos(a) * r, Mathf.Sin(a) * r, 0)); + } + Debug.Log($"[TouchPosition] {name}: 蓝描边已创建"); + } private void OnMouseDown() { + Debug.Log($"[TouchPosition] {name}: 被点击"); + if (womanObject != null && targetPosition != null) { womanObject.transform.position = targetPosition.position; @@ -21,5 +57,17 @@ public class TouchPositionHandler : MonoBehaviour { Debug.LogWarning($"[TouchPosition] {name}: womanObject 或 targetPosition 为空"); } + + // 顺序显示:隐藏自己,显示下一个 + gameObject.SetActive(false); + if (nextTouchObject != null) + { + nextTouchObject.SetActive(true); + Debug.Log($"[TouchPosition] {name} 已隐藏 -> {nextTouchObject.name} 已显示"); + } + else + { + Debug.Log($"[TouchPosition] {name} 已隐藏,无下一个"); + } } }