Files
zeling_v2/Assets/_Game/Scripts/Player/States/DeadState.cs
Joywayer b7baf7ad6a Add WeaponFeedback component and AddressableManagerWindow meta file
- Implemented WeaponFeedback class for handling weapon-related feedbacks such as hit effects and attack sounds.
- Added meta file for AddressableManagerWindow to manage addressable assets.
- Included a new jump.data file for profiler data.
2026-05-22 22:03:32 +08:00

42 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
Feedback.PlayDeath();
// 播放死亡动画
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() { }
}
}