diff --git a/Assets/Scripts/Interaction/ShoseClickHandler.cs b/Assets/Scripts/Interaction/ShoseClickHandler.cs
index 9be0d80..f6e4a58 100644
--- a/Assets/Scripts/Interaction/ShoseClickHandler.cs
+++ b/Assets/Scripts/Interaction/ShoseClickHandler.cs
@@ -1,28 +1,25 @@
using UnityEngine;
-///
-/// Shose 交互:模型可见 + 外圈蓝色描边闪烁,点击后移动到 ShosePoint
-///
public class ShoseClickHandler : MonoBehaviour
{
public GameObject nextObject;
public Transform targetPoint;
-
private MeshRenderer _outlineMesh;
void OnEnable()
{
- // 不隐藏模型!只加描边子对象
- if (GetComponent() == null)
- {
- var sc = gameObject.AddComponent();
- sc.radius = 1.0f;
- sc.isTrigger = false;
- }
+ // 强制确保有足够大的 collider
+ var col = GetComponent();
+ if (col == null) col = gameObject.AddComponent();
+ if (col is SphereCollider sc) { sc.radius = 1.2f; sc.isTrigger = false; }
+ // 干掉可能拦截点击的旧组件
+ var drag = GetComponent();
+ if (drag != null) Destroy(drag);
+
CreateOutlineMesh();
StopAllCoroutines();
StartCoroutine(BlinkOutline());
- Debug.Log($"[ShoseClick] OnEnable outline={_outlineMesh!=null} collider={GetComponent()!=null}");
+ Debug.Log($"[ShoseClick] OnEnable outline={_outlineMesh!=null} col radius={(col is SphereCollider sc2?sc2.radius:-1)}");
}
void CreateOutlineMesh()
@@ -30,9 +27,9 @@ public class ShoseClickHandler : MonoBehaviour
if (_outlineMesh != null) return;
var mf = GetComponent();
if (mf == null) mf = GetComponentInChildren();
- if (mf == null || mf.sharedMesh == null) { Debug.LogWarning("[ShoseClick] 无Mesh"); return; }
+ if (mf == null || mf.sharedMesh == null) return;
var shader = Shader.Find("Custom/OutlineUnlit");
- if (shader == null) { Debug.LogWarning("[ShoseClick] Shader缺失"); return; }
+ if (shader == null) return;
var mat = new Material(shader);
mat.SetColor("_OutlineColor", new Color(0.2f, 0.5f, 1f, 1f));
mat.SetColor("_MainColor", new Color(0, 0, 0, 0));
@@ -57,10 +54,11 @@ public class ShoseClickHandler : MonoBehaviour
void OnMouseDown()
{
- Debug.Log("[ShoseClick] 被点击");
+ Debug.Log("[ShoseClick] ★ 被点击了 ★");
StopAllCoroutines();
if (_outlineMesh != null) _outlineMesh.enabled = false;
- if (targetPoint != null) { transform.position = targetPoint.position; transform.rotation = targetPoint.rotation; }
+ if (targetPoint != null) { transform.position = targetPoint.position; transform.rotation = targetPoint.rotation; Debug.Log($"[ShoseClick] 移动到 {targetPoint.name}"); }
+ else Debug.LogWarning("[ShoseClick] targetPoint 为空!");
if (nextObject != null) nextObject.SetActive(true);
}
}