fix: 重建TouchPositionHandler.cs修复括号混乱编译错误

This commit is contained in:
yangbear
2026-07-01 21:07:01 +08:00
parent d0e4d5d8c5
commit 3a83140801
@@ -19,12 +19,19 @@ public class TouchPositionHandler : MonoBehaviour
StartCoroutine(BlinkMesh());
}
private void OnEnable()
{
_meshRenderer = GetComponent<MeshRenderer>();
if (_meshRenderer != null) _meshRenderer.enabled = true;
StopAllCoroutines();
StartCoroutine(BlinkMesh());
}
private System.Collections.IEnumerator BlinkMesh()
{
while (true)
{
if (_meshRenderer != null)
_meshRenderer.enabled = !_meshRenderer.enabled;
if (_meshRenderer != null) _meshRenderer.enabled = !_meshRenderer.enabled;
yield return new WaitForSeconds(0.4f);
}
}
@@ -38,9 +45,14 @@ public class TouchPositionHandler : MonoBehaviour
womanObject.transform.position = targetPosition.position;
womanObject.transform.rotation = targetPosition.rotation;
Debug.Log($"[TouchPosition] woman 移动到 {targetPosition.name}");
if (voiceClip != null) { AudioSource.PlayClipAtPoint(voiceClip, transform.position); Debug.Log("[TouchPosition] 播放语音: " + voiceClip.name);
}
if (voiceClip != null)
{
AudioSource.PlayClipAtPoint(voiceClip, transform.position);
Debug.Log($"[TouchPosition] 播放语音: {voiceClip.name}");
}
// 通知 StepManager 记录步骤
int stepIndex = transform.GetSiblingIndex() + 1;
var sm = FindObjectOfType<StepManager>();
if (sm != null) sm.RecordWomanStep(stepIndex);
@@ -55,13 +67,4 @@ public class TouchPositionHandler : MonoBehaviour
Debug.Log($"[TouchPosition] {name} → {nextTouchObject.name} 显示");
}
}
private void OnEnable()
{
_meshRenderer = GetComponent<MeshRenderer>();
if (_meshRenderer != null) _meshRenderer.enabled = true;
StopAllCoroutines();
StartCoroutine(BlinkMesh());
}
}