a11e003fcd
- 加权评分系统:每步独立 ScoreWeight,满分 100,SequenceClick 按子项比例计分 - StepData 新增 DetailedContent(学习模式详细操作说明)和 SubStepCount - 伤情检查步骤扩展为 5 子项序列(视觉检查→肿胀→疼痛→生命体征→神经评估) - 夹板固定模式完整评分(选择夹板→放置衬垫→夹板固定→固定后检查) - Doc/ 文件夹归档三份文档:项目大纲、文案、评分标准 - README 更新评分权重表和夹板固定流程
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;
|
|
}
|
|
}
|