Files
VFSUnity/Assets/Scripts/Interaction/TouchPositionHandler.cs
T
yangbear 524ad732f9 feat: 双Pass膨胀描边shader替代LineRenderer
- 新增 Custom/OutlineUnlit shader: Pass1膨胀描边(Cull Front)+Pass2内芯填充
- BlueOutline.mat: 蓝色描边+半透蓝填充
- TouchPositionHandler改用MeshRenderer.enabled闪烁
- 球体挂MeshRenderer+Outline材质,0.4s闪烁
2026-06-30 03:02:12 +08:00

53 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
/// <summary>
/// 挂在 touchArray 子球体上。球体用双Pass膨胀描边shaderCustom/OutlineUnlit),
/// 闪烁提示用户点击。点击后移动到对应位置并顺序显示下一个。
/// </summary>
public class TouchPositionHandler : MonoBehaviour
{
public Transform targetPosition;
public GameObject womanObject;
public GameObject nextTouchObject;
private MeshRenderer _meshRenderer;
private void Start()
{
_meshRenderer = GetComponent<MeshRenderer>();
StartCoroutine(BlinkMesh());
}
private System.Collections.IEnumerator BlinkMesh()
{
while (true)
{
if (_meshRenderer != null)
_meshRenderer.enabled = !_meshRenderer.enabled;
yield return new WaitForSeconds(0.4f);
}
}
private void OnMouseDown()
{
Debug.Log($"[TouchPosition] {name}: 被点击");
if (womanObject != null && targetPosition != null)
{
womanObject.transform.position = targetPosition.position;
womanObject.transform.rotation = targetPosition.rotation;
Debug.Log($"[TouchPosition] woman 移动到 {targetPosition.name}");
}
StopAllCoroutines();
if (_meshRenderer != null) _meshRenderer.enabled = false;
gameObject.SetActive(false);
if (nextTouchObject != null)
{
nextTouchObject.SetActive(true);
Debug.Log($"[TouchPosition] {name} → {nextTouchObject.name} 显示");
}
}
}