f0a6b96da5
- 删除重复 Ground - 创建 [Managers] 空物体,挂载 GameManager + StepManager + ExperimentFlowCoordinator + AudioManager - Main Camera 挂载 InteractionSystem - 伤者 InjectedPerson 下创建 5 个交互子物体 (InjuryVisual/Swelling/Pain/VitalSigns/Neuro) - 创建绑带位置、踝关节、衬垫、夹板位置等空物体 - 道具摆放到位:伤者(2,0.05,5) 施救者(3,0,5) 鞋(2.7,0.15,5.5) 绷带/夹板/急救箱在旁 - InjuryLeg Tag 修正,Ground Tag 修正 - 全部新脚本同步导入 (ExperimentTypes/StepData/ExperimentConfig/StepManager/GameManager/ExperimentFlowCoordinator/InteractionSystem/DraggableObject/HighlightEffect/UIManager/ExamPopup/ScoreDisplay/VideoController/AudioManager/CharacterAnimController/StepAnimationHandler) - 旧脚本 (ExperimentController/ConfigLoader/AnimationController/HUDController/VideoPlayerController/PopupSystem/ModeSelectionUI) 全部兼容修复或 stub - 编译通过,0 错误 - Canvas 挂载 UIManager
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
/// <summary>
|
|
/// 挂载在可拖拽的 3D 物体上(如绷带、夹板)。
|
|
/// 配合 InteractionSystem 使用。
|
|
/// </summary>
|
|
public class DraggableObject : MonoBehaviour
|
|
{
|
|
[Header("拖拽状态")]
|
|
public bool IsDraggable = true;
|
|
|
|
[Header("吸附目标")]
|
|
public Transform SnapTarget;
|
|
|
|
[Header("事件")]
|
|
public UnityEvent OnDragStartEvent;
|
|
public UnityEvent OnDragEndEvent;
|
|
public UnityEvent OnSnappedEvent; // 吸附成功
|
|
|
|
private Vector3 _originalPosition;
|
|
private Quaternion _originalRotation;
|
|
|
|
private void Start()
|
|
{
|
|
_originalPosition = transform.position;
|
|
_originalRotation = transform.rotation;
|
|
}
|
|
|
|
public void OnDragStart()
|
|
{
|
|
OnDragStartEvent?.Invoke();
|
|
}
|
|
|
|
public void OnDragEnd()
|
|
{
|
|
OnDragEndEvent?.Invoke();
|
|
}
|
|
|
|
public void OnSnapped()
|
|
{
|
|
Debug.Log($"DraggableObject: {name} 已吸附到目标");
|
|
OnSnappedEvent?.Invoke();
|
|
IsDraggable = false; // 吸附后不可再拖动
|
|
}
|
|
|
|
/// <summary>重置到初始位置</summary>
|
|
public void ResetPosition()
|
|
{
|
|
transform.position = _originalPosition;
|
|
transform.rotation = _originalRotation;
|
|
IsDraggable = true;
|
|
}
|
|
}
|