- 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.
41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
namespace BaseGames.Enemies.States
|
|
{
|
|
/// <summary>
|
|
/// 击飞腾空状态:施加击飞冲量,播放 KnockUp 动画直至落地/动画结束后恢复 Controlled。
|
|
///
|
|
/// 触发条件:TakeDamage 检测到 DamageFlags.Launch + 伤害 >= 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) { }
|
|
}
|
|
}
|