- 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.
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
#if GRAPH_DESIGNER
|
||
using UnityEngine;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks.Actions;
|
||
using BaseGames.Enemies;
|
||
using BaseGames.Enemies.Abilities;
|
||
|
||
namespace BaseGames.Enemies.AI
|
||
{
|
||
/// <summary>
|
||
/// BD Action:强制切换敌人到指定 EnemyStateType,并中断所有正在执行的能力。
|
||
/// 单帧完成,立即返回 Success。
|
||
///
|
||
/// 典型用法:
|
||
/// - 进入 Stagger 状态后重置为 Idle(替代手动停止动画)
|
||
/// - 技能打断后显式回到 Controlled 状态
|
||
/// </summary>
|
||
[TaskName("Set State")]
|
||
[TaskCategory("BaseGames/Enemy/State")]
|
||
[TaskDescription("强制切换敌人物理/战斗状态(ForceState)")]
|
||
public class BD_SetState : Action
|
||
{
|
||
[Tooltip("切换到的目标状态")]
|
||
[SerializeField] private EnemyStateType m_TargetState = EnemyStateType.Controlled;
|
||
|
||
[Tooltip("切换状态时同时中断所有正在执行的能力")]
|
||
[SerializeField] private bool m_InterruptAbilities = true;
|
||
|
||
private EnemyBase _enemy;
|
||
|
||
public override void OnAwake() => _enemy = GetComponent<EnemyBase>();
|
||
|
||
public override TaskStatus OnUpdate()
|
||
{
|
||
if (_enemy == null) return TaskStatus.Failure;
|
||
|
||
if (m_InterruptAbilities)
|
||
_enemy.Abilities?.InterruptAll(InterruptReason.ExternalRequest);
|
||
|
||
_enemy.ForceState(m_TargetState);
|
||
return TaskStatus.Success;
|
||
}
|
||
}
|
||
}
|
||
#endif
|