7100305765
- TouchPositionHandler: 点击touchArray球体→woman移动到womanPointArray对应位置 - medicalBox: 初始隐藏,实验开始后显示 - ReturnToHome: 重置场景(恢复man/man2, 隐藏woman/manInjury/medicalBox, 切回主摄像机, 重置Animator) - ActivateExperimentObjects(): 实验启动时激活实验物件
26 lines
832 B
C#
26 lines
832 B
C#
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 挂在 touchArray 的每个子球体上,点击时把 woman 移动到 womanPointArray 对应位置。
|
|
/// 字段用 public 方便代码直接赋值。
|
|
/// </summary>
|
|
public class TouchPositionHandler : MonoBehaviour
|
|
{
|
|
public Transform targetPosition;
|
|
public GameObject womanObject;
|
|
|
|
private void OnMouseDown()
|
|
{
|
|
if (womanObject != null && targetPosition != null)
|
|
{
|
|
womanObject.transform.position = targetPosition.position;
|
|
womanObject.transform.rotation = targetPosition.rotation;
|
|
Debug.Log($"[TouchPosition] woman 移动到 {targetPosition.name} ({targetPosition.position})");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning($"[TouchPosition] {name}: womanObject 或 targetPosition 为空");
|
|
}
|
|
}
|
|
}
|