diff --git a/Assets/Scripts/Interaction/ShoseClickHandler.cs b/Assets/Scripts/Interaction/ShoseClickHandler.cs
index 574718a..fa7ec8e 100644
--- a/Assets/Scripts/Interaction/ShoseClickHandler.cs
+++ b/Assets/Scripts/Interaction/ShoseClickHandler.cs
@@ -1,23 +1,28 @@
using UnityEngine;
+///
+/// Shose 交互:模型可见 + 外圈蓝色描边闪烁,点击后移动到 ShosePoint
+///
public class ShoseClickHandler : MonoBehaviour
{
public GameObject nextObject;
public Transform targetPoint;
- private MeshRenderer _modelRenderer, _outlineMesh;
+ private MeshRenderer _outlineMesh;
void OnEnable()
{
- _modelRenderer = GetComponent();
- if (_modelRenderer == null) _modelRenderer = GetComponentInChildren();
- if (_modelRenderer != null) _modelRenderer.enabled = false;
- // 确保有 collider
- if (GetComponent() == null) { var sc = gameObject.AddComponent(); sc.radius = 0.5f; }
+ // 不隐藏模型!只加描边子对象
+ if (GetComponent() == null)
+ {
+ var sc = gameObject.AddComponent();
+ sc.radius = 0.5f;
+ sc.isTrigger = false;
+ }
CreateOutlineMesh();
StopAllCoroutines();
StartCoroutine(BlinkOutline());
- Debug.Log($"[ShoseClick] OnEnable modelRenderer={_modelRenderer!=null} outlineMesh={_outlineMesh!=null}");
+ Debug.Log($"[ShoseClick] OnEnable outline={_outlineMesh!=null} collider={GetComponent()!=null}");
}
void CreateOutlineMesh()
@@ -25,13 +30,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] 无 MeshFilter 或 sharedMesh,无法创建描边");
- return;
- }
+ if (mf == null || mf.sharedMesh == null) { Debug.LogWarning("[ShoseClick] 无Mesh"); return; }
var shader = Shader.Find("Custom/OutlineUnlit");
- if (shader == null) { Debug.LogWarning("[ShoseClick] Custom/OutlineUnlit shader 未找到"); return; }
+ if (shader == null) { Debug.LogWarning("[ShoseClick] Shader缺失"); 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));
@@ -41,7 +42,6 @@ public class ShoseClickHandler : MonoBehaviour
go.AddComponent().sharedMesh = mf.sharedMesh;
_outlineMesh = go.AddComponent();
_outlineMesh.material = mat;
- Debug.Log("[ShoseClick] 描边已创建");
}
System.Collections.IEnumerator BlinkOutline()
@@ -59,7 +59,6 @@ public class ShoseClickHandler : MonoBehaviour
{
Debug.Log("[ShoseClick] 被点击");
StopAllCoroutines();
- if (_modelRenderer != null) _modelRenderer.enabled = true;
if (_outlineMesh != null) _outlineMesh.enabled = false;
if (targetPoint != null) { transform.position = targetPoint.position; transform.rotation = targetPoint.rotation; }
if (nextObject != null) nextObject.SetActive(true);