using UnityEngine; public class Point2ClickHandler : MonoBehaviour { public GameObject nextObject; // This will be Shose private bool _clicked; public bool CanBeClicked() { return !_clicked; } private MeshRenderer _meshRenderer; void OnEnable() { if (GetComponent() == null) gameObject.AddComponent().radius = 0.5f; _meshRenderer = GetComponent(); if (_meshRenderer != null) { _meshRenderer.enabled = true; var mat = _meshRenderer.material; if (mat != null && mat.HasProperty("_MainColor")) { var c = mat.GetColor("_MainColor"); c.a = 0f; mat.SetColor("_MainColor", c); if (mat.HasProperty("_OutlineWidth")) { mat.SetFloat("_OutlineWidth", OutlineConfig.Width); } } } _clicked = false; StopAllCoroutines(); StartCoroutine(BlinkOutline()); } System.Collections.IEnumerator BlinkOutline() { yield return new WaitForSeconds(0.4f); while (true) { if (_meshRenderer != null) _meshRenderer.enabled = !_meshRenderer.enabled; yield return new WaitForSeconds(0.4f); } } void OnMouseDown() { PerformClick(); } public void PerformClick() { if (_clicked) return; _clicked = true; Debug.Log("[Point2Click] ★ 被点击 ★"); ActionHistory.Push(ActionHistory.ActionType.Point2, this); StopAllCoroutines(); if (_meshRenderer != null) _meshRenderer.enabled = false; var woman = GameObject.Find("woman"); if (woman != null) { var anim = woman.GetComponent(); if (anim != null) { anim.SetBool("IsCheck", true); } } if (nextObject != null) nextObject.SetActive(true); gameObject.SetActive(false); } public void ResetState() { _clicked = false; if (_meshRenderer != null) _meshRenderer.enabled = true; if (nextObject != null) nextObject.SetActive(false); var woman = GameObject.Find("woman"); if (woman != null) { var anim = woman.GetComponent(); if (anim != null) { anim.SetBool("IsCheck", false); } } gameObject.SetActive(true); StopAllCoroutines(); StartCoroutine(BlinkOutline()); } }