Files
zeling_v2/Assets/_Game/Scripts/Enemies/States/EnemyKnockUpState.cs
Joywayer a1b4e629aa feat: Implement Room Streaming System
- Add RoomStreamingManager to manage room loading and unloading based on player proximity.
- Create StreamingBudgetConfigSO for memory and performance budgeting of the streaming system.
- Introduce TransitionDirector to handle seamless and atmospheric fade transitions between rooms.
- Develop WorldGraph to represent room connectivity and facilitate neighbor queries and distance calculations.
- Implement RoomNode and RoomEdge classes to structure room data and connections.
2026-05-23 19:10:29 +08:00

41 lines
1.6 KiB
C#
Raw Permalink 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.Enemies.States
{
/// <summary>
/// 击飞腾空状态:施加击飞冲量,播放 KnockUp 动画直至落地/动画结束后恢复 Controlled。
///
/// 触发条件TakeDamage 检测到 DamageFlags.Launch + 伤害 &gt;= launchThreshold。
/// 来袭方向由 <see cref="EnemyBase.PendingLaunchDir"/> 提供。
/// 若 AnimConfig 无 KnockUp Clip则通过 <see cref="EnemyBase.ScheduleStateRecovery"/> 按时长兜底恢复。
/// </summary>
public sealed class EnemyKnockUpState : IEnemyState
{
public EnemyStateType StateType => EnemyStateType.KnockUp;
public void Enter(EnemyBase owner)
{
var cfg = owner.StatsSO?.HitTiers ?? default;
// 施加击飞冲量
owner.Movement?.LaunchKnockup(owner.PendingLaunchDir, cfg.launchHorzForce, cfg.launchUpForce);
if (owner.Animancer != null && owner.AnimConfig?.KnockUp != null)
{
var animState = owner.Animancer.Play(owner.AnimConfig.KnockUp);
animState.Events(owner).OnEnd = () =>
{
if (owner.CurrentState == EnemyStateType.KnockUp)
owner.ForceState(EnemyStateType.Controlled);
};
}
else
{
// 无 KnockUp 动画:按配置时长自动恢复
float duration = cfg.knockUpDuration > 0f ? cfg.knockUpDuration : 0.5f;
owner.ScheduleStateRecovery(EnemyStateType.KnockUp, duration);
}
}
public void Exit(EnemyBase owner) { }
}
}