摄像机区域的架构改动

This commit is contained in:
2026-05-15 14:47:24 +08:00
parent 1b37297585
commit f264329751
3591 changed files with 1687228 additions and 446503 deletions

View File

@@ -0,0 +1,26 @@
namespace BaseGames.Enemies.States
{
/// <summary>
/// 受击状态。播放受击动画,动画结束后自动回到 Controlled。
/// 原 EnemyBase.ForceState 中的 Hurt if-else 逻辑已迁移至此。
/// </summary>
public sealed class EnemyHurtState : IEnemyState
{
public EnemyStateType StateType => EnemyStateType.Hurt;
public void Enter(EnemyBase owner)
{
if (owner.Animancer == null || owner.AnimConfig?.Hurt == null) return;
var animState = owner.Animancer.Play(owner.AnimConfig.Hurt);
animState.Events(owner).OnEnd = () =>
{
// 只在仍处于 Hurt 时才回 Controlled避免 Die 时被覆盖
if (owner.CurrentState == EnemyStateType.Hurt)
owner.ForceState(EnemyStateType.Controlled);
};
}
public void Exit(EnemyBase owner) { }
}
}