- 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.
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
#if GRAPH_DESIGNER
|
||
using UnityEngine;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks.Actions;
|
||
using BaseGames.Enemies;
|
||
|
||
namespace BaseGames.Enemies.AI
|
||
{
|
||
/// <summary>
|
||
/// BD Action:启动 Boss 阶段过渡演出(无敌帧 + 可选定格),等待过渡完成后返回 Success。
|
||
///
|
||
/// 返回 Running:过渡演出进行中(BossBase.IsPhaseTransitioning = true)。
|
||
/// 返回 Success:过渡完成,已切换到目标阶段。
|
||
/// 返回 Failure:BossBase 组件不存在。
|
||
///
|
||
/// 典型 BT 用法:
|
||
/// Sequence [ BD_IsHPBelow(0.5) → BD_BossPhaseTransition(Phase=1, Duration=1.5) → ... ]
|
||
/// </summary>
|
||
[TaskName("Boss Phase Transition")]
|
||
[TaskCategory("BaseGames/Enemy/Boss")]
|
||
[TaskDescription("触发 Boss 阶段过渡演出(无敌 + 动画 + 广播事件)")]
|
||
public class BD_BossPhaseTransition : Action
|
||
{
|
||
[Tooltip("切换到的目标阶段索引")]
|
||
[SerializeField] private int m_TargetPhase = 1;
|
||
|
||
[Tooltip("无敌帧 + 过渡演出持续时间(秒)")]
|
||
[SerializeField, Min(0f)] private float m_InvincibleDuration = 1.5f;
|
||
|
||
private BossBase _boss;
|
||
private bool _started;
|
||
|
||
public override void OnAwake() => _boss = GetComponent<BossBase>();
|
||
|
||
public override void OnStart()
|
||
{
|
||
_started = false;
|
||
}
|
||
|
||
public override TaskStatus OnUpdate()
|
||
{
|
||
if (_boss == null) return TaskStatus.Failure;
|
||
|
||
if (!_started)
|
||
{
|
||
_boss.BeginPhaseTransition(m_TargetPhase, m_InvincibleDuration);
|
||
_started = true;
|
||
}
|
||
|
||
return _boss.IsPhaseTransitioning ? TaskStatus.Running : TaskStatus.Success;
|
||
}
|
||
}
|
||
}
|
||
#endif
|