多轮审查和修复
This commit is contained in:
39
Assets/Scripts/Player/States/DeadState.cs
Normal file
39
Assets/Scripts/Player/States/DeadState.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace BaseGames.Player.States
|
||||
{
|
||||
/// <summary>
|
||||
/// 死亡状态(架构 05_PlayerModule §2)。
|
||||
/// 冻结物理(ZeroVelocity + 关闭重力),播放 Dead 动画;
|
||||
/// 不自动转出 — 由 DeathRespawnSystem 通过 EVT_PlayerRespawned 触发重置。
|
||||
/// </summary>
|
||||
public class DeadState : PlayerStateBase
|
||||
{
|
||||
public DeadState(PlayerController owner) : base(owner) { }
|
||||
|
||||
public override void OnStateEnter()
|
||||
{
|
||||
// 冻结物理
|
||||
Move?.ZeroVelocity();
|
||||
Move?.SetGravityScale(0f);
|
||||
|
||||
// 禁用 HurtBox(防止重复受击)
|
||||
if (Owner.HurtBox != null)
|
||||
Owner.HurtBox.SetActive(false);
|
||||
|
||||
// 播放死亡动画
|
||||
if (AnimCfg?.Dead != null)
|
||||
Anim?.Play(AnimCfg.Dead);
|
||||
}
|
||||
|
||||
public override void OnStateExit()
|
||||
{
|
||||
// 复活时恢复重力和 HurtBox
|
||||
Move?.SetGravityScale(Owner.MovConfig.DefaultGravityScale);
|
||||
if (Owner.HurtBox != null)
|
||||
Owner.HurtBox.SetActive(true);
|
||||
}
|
||||
|
||||
// 死亡状态不接受任何输入或状态转换
|
||||
public override void OnStateUpdate() { }
|
||||
public override void OnStateFixedUpdate() { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user