diff --git a/Assets/Scripts/Interaction/ShoseClickHandler.cs b/Assets/Scripts/Interaction/ShoseClickHandler.cs index ce6a625..271ac8b 100644 --- a/Assets/Scripts/Interaction/ShoseClickHandler.cs +++ b/Assets/Scripts/Interaction/ShoseClickHandler.cs @@ -7,17 +7,14 @@ public class ShoseClickHandler : MonoBehaviour private MeshRenderer _outlineMesh; private bool _clicked; - void OnEnable() + void Start() { var col = GetComponent(); - if (col == null) col = gameObject.AddComponent(); + if (col == null) { col = gameObject.AddComponent(); ((SphereCollider)col).radius = 3f; } col.enabled = true; - if (col is SphereCollider sc) { sc.radius = 1.5f; sc.isTrigger = false; } CreateOutlineMesh(); - StopAllCoroutines(); StartCoroutine(BlinkOutline()); - _clicked = false; - Debug.Log($"[ShoseClick] OnEnable obj={gameObject.name} outline={_outlineMesh!=null} col enabled={col.enabled} radius={((SphereCollider)col).radius}"); + Debug.Log($"[ShoseClick] Start obj={gameObject.name} col={col.enabled} radius={((SphereCollider)col).radius}"); } void CreateOutlineMesh() @@ -46,38 +43,14 @@ public class ShoseClickHandler : MonoBehaviour while (true) { if (_outlineMesh != null) _outlineMesh.enabled = !_outlineMesh.enabled; yield return new WaitForSeconds(0.4f); } } - void Update() - { - if (_clicked || !Input.GetMouseButtonDown(0)) return; - var cams = Object.FindObjectsOfType(); - foreach (var cam in cams) - { - if (!cam.enabled) continue; - var hits = Physics.RaycastAll(cam.ScreenPointToRay(Input.mousePosition), 200f); - if (hits.Length > 0) - { - var names = new System.Text.StringBuilder(); - foreach (var h in hits) names.Append(h.collider?.gameObject?.name ?? "null").Append(", "); - Debug.Log($"[ShoseClick] ★ Update click! hits={hits.Length} — {names}"); - } - foreach (var h in hits) - { - if (h.collider != null && (h.collider.gameObject == gameObject || h.collider.gameObject.name == gameObject.name)) - { - OnClicked(); return; - } - } - } - } - - void OnClicked() + void OnMouseDown() { + if (_clicked) return; _clicked = true; - Debug.Log($"[ShoseClick] ★ {gameObject.name} 被点击了 ★"); + Debug.Log("[ShoseClick] ★ 模型被点击了! ★"); StopAllCoroutines(); if (_outlineMesh != null) _outlineMesh.enabled = false; - if (targetPoint != null) { transform.position = targetPoint.position; transform.rotation = targetPoint.rotation; Debug.Log($"[ShoseClick] 移动到 {targetPoint.name}"); } - else Debug.LogWarning("[ShoseClick] targetPoint 为空"); + if (targetPoint != null) { transform.position = targetPoint.position; transform.rotation = targetPoint.rotation; } if (nextObject != null) nextObject.SetActive(true); } } diff --git a/Packages/manifest.json b/Packages/manifest.json index 9cb0659..afd422f 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,15 +1,19 @@ { "dependencies": { "com.coplaydev.unity-mcp": "https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main", + "com.unity.cinemachine": "3.1.7", + "com.unity.cloud.gltfast": "6.14.1", "com.unity.collab-proxy": "2.7.1", "com.unity.ide.rider": "3.0.36", "com.unity.ide.visualstudio": "2.0.22", "com.unity.ide.vscode": "1.2.5", + "com.unity.probuilder": "5.2.4", "com.unity.render-pipelines.universal": "14.0.12", "com.unity.test-framework": "1.1.33", "com.unity.textmeshpro": "3.0.7", "com.unity.timeline": "1.7.7", "com.unity.ugui": "1.0.0", + "com.unity.visualeffectgraph": "14.0.12", "com.unity.visualscripting": "1.9.4", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 5cbd133..a28dedb 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -18,7 +18,7 @@ "hash": "11836003a5e2ffcb7715ecec7e1fbb9d9cdb5bb8" }, "com.unity.burst": { - "version": "1.8.21", + "version": "1.8.24", "depth": 1, "source": "registry", "dependencies": { @@ -27,6 +27,29 @@ }, "url": "https://packages.unity.cn" }, + "com.unity.cinemachine": { + "version": "3.1.7", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.splines": "2.0.0", + "com.unity.modules.imgui": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, + "com.unity.cloud.gltfast": { + "version": "6.14.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.burst": "1.8.24", + "com.unity.collections": "1.2.4", + "com.unity.mathematics": "1.2.6", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + }, + "url": "https://packages.unity.cn" + }, "com.unity.collab-proxy": { "version": "2.7.1", "depth": 0, @@ -34,6 +57,16 @@ "dependencies": {}, "url": "https://packages.unity.cn" }, + "com.unity.collections": { + "version": "1.2.4", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.burst": "1.6.6", + "com.unity.test-framework": "1.1.31" + }, + "url": "https://packages.unity.cn" + }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, @@ -80,6 +113,17 @@ "dependencies": {}, "url": "https://packages.unity.cn" }, + "com.unity.probuilder": { + "version": "5.2.4", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.settings-manager": "1.0.3" + }, + "url": "https://packages.unity.cn" + }, "com.unity.render-pipelines.core": { "version": "14.0.12", "depth": 1, @@ -118,6 +162,13 @@ "dependencies": {}, "url": "https://packages.unity.cn" }, + "com.unity.settings-manager": { + "version": "2.1.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, "com.unity.shadergraph": { "version": "14.0.12", "depth": 1, @@ -127,6 +178,17 @@ "com.unity.searcher": "4.9.2" } }, + "com.unity.splines": { + "version": "2.8.0", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.mathematics": "1.2.1", + "com.unity.modules.imgui": "1.0.0", + "com.unity.settings-manager": "1.0.3" + }, + "url": "https://packages.unity.cn" + }, "com.unity.test-framework": { "version": "1.1.33", "depth": 0, @@ -168,6 +230,15 @@ "com.unity.modules.imgui": "1.0.0" } }, + "com.unity.visualeffectgraph": { + "version": "14.0.12", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.shadergraph": "14.0.12", + "com.unity.render-pipelines.core": "14.0.12" + } + }, "com.unity.visualscripting": { "version": "1.9.4", "depth": 0, diff --git a/ProjectSettings/Packages/com.unity.probuilder/Settings.json b/ProjectSettings/Packages/com.unity.probuilder/Settings.json new file mode 100644 index 0000000..4eac871 --- /dev/null +++ b/ProjectSettings/Packages/com.unity.probuilder/Settings.json @@ -0,0 +1,16 @@ +{ + "m_Dictionary": { + "m_DictionaryValues": [ + { + "type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "about.identifier", + "value": "{\"m_Value\":{\"m_Major\":5,\"m_Minor\":2,\"m_Patch\":4,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}" + }, + { + "type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "preferences.version", + "value": "{\"m_Value\":{\"m_Major\":5,\"m_Minor\":2,\"m_Patch\":4,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}" + } + ] + } +} \ No newline at end of file