feat: MCP Unity 场景优化 — 完整交互体系搭建
- 删除重复 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
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 角色动画控制器:管理伤者和施救者的动画状态切换。
|
||||
/// 挂在角色根 GameObject 上,引用其 Animator 组件。
|
||||
/// </summary>
|
||||
public class CharacterAnimController : MonoBehaviour
|
||||
{
|
||||
public enum CharacterRole { Patient, Rescuer }
|
||||
public CharacterRole Role = CharacterRole.Patient;
|
||||
|
||||
[Header("Animator 引用")]
|
||||
[SerializeField] private Animator _animator;
|
||||
|
||||
private static readonly int ParamRun = Animator.StringToHash("IsRunning");
|
||||
private static readonly int ParamJump = Animator.StringToHash("Jump");
|
||||
private static readonly int ParamFall = Animator.StringToHash("Fall");
|
||||
private static readonly int ParamLying = Animator.StringToHash("IsLying");
|
||||
private static readonly int ParamCrouch = Animator.StringToHash("Crouch");
|
||||
private static readonly int ParamCheck = Animator.StringToHash("Check");
|
||||
private static readonly int ParamBandage = Animator.StringToHash("Bandage");
|
||||
private static readonly int ParamRemoveShoe = Animator.StringToHash("RemoveShoe");
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (_animator == null) _animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
public void PlayRun()
|
||||
{
|
||||
if (_animator == null) return;
|
||||
_animator.SetBool(ParamRun, true);
|
||||
}
|
||||
|
||||
public void StopRun()
|
||||
{
|
||||
if (_animator == null) return;
|
||||
_animator.SetBool(ParamRun, false);
|
||||
}
|
||||
|
||||
public void TriggerJump()
|
||||
{
|
||||
_animator?.SetTrigger(ParamJump);
|
||||
}
|
||||
|
||||
public void TriggerFall()
|
||||
{
|
||||
_animator?.SetTrigger(ParamFall);
|
||||
_animator?.SetBool(ParamLying, true);
|
||||
}
|
||||
|
||||
public void SetLying(bool lying)
|
||||
{
|
||||
_animator?.SetBool(ParamLying, lying);
|
||||
}
|
||||
|
||||
public void PlayCrouch()
|
||||
{
|
||||
_animator?.SetBool(ParamCrouch, true);
|
||||
}
|
||||
|
||||
public void StopCrouch()
|
||||
{
|
||||
_animator?.SetBool(ParamCrouch, false);
|
||||
}
|
||||
|
||||
public void TriggerCheck()
|
||||
{
|
||||
_animator?.SetTrigger(ParamCheck);
|
||||
}
|
||||
|
||||
public void TriggerBandage()
|
||||
{
|
||||
_animator?.SetTrigger(ParamBandage);
|
||||
}
|
||||
|
||||
public void TriggerRemoveShoe()
|
||||
{
|
||||
_animator?.SetTrigger(ParamRemoveShoe);
|
||||
}
|
||||
|
||||
public void TriggerByName(string triggerName)
|
||||
{
|
||||
if (_animator == null || string.IsNullOrEmpty(triggerName)) return;
|
||||
_animator.SetTrigger(Animator.StringToHash(triggerName));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user