- 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.9 KiB
C#
55 lines
1.9 KiB
C#
#if GRAPH_DESIGNER
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks.Actions;
|
||
using UnityEngine;
|
||
|
||
namespace BaseGames.Enemies.AI
|
||
{
|
||
/// <summary>
|
||
/// BD Action:在当前阶段可用且冷却就绪的技能中,按 weight 加权随机选择一个技能并执行。
|
||
///
|
||
/// 返回 Running:技能正在执行。
|
||
/// 返回 Success:技能执行完成。
|
||
/// 返回 Failure:无可用技能,或执行器忙。
|
||
///
|
||
/// 用法:在 Boss BT 的 Combat 阶段,替代 BD_UseBossSkill(固定 ID)实现随机化技能组合。
|
||
/// 每个 BossSkillSO 设置 weight 字段控制出现概率:越大越常见。
|
||
/// </summary>
|
||
[TaskName("Use Boss Skill (Weighted)")]
|
||
[TaskCategory("BaseGames/Enemy/Boss")]
|
||
[TaskDescription("加权随机选择并执行可用技能;对上一次使用的技能施加权重惩罚")]
|
||
public class BD_UseBossSkillWeighted : Action
|
||
{
|
||
[Tooltip("等待技能执行完成后才返回 Success。关闭后执行开始即返回 Success,BT 继续运行其他节点。")]
|
||
[SerializeField] private bool m_WaitForCompletion = true;
|
||
|
||
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)
|
||
{
|
||
bool ok = _boss.UseBossSkillWeighted();
|
||
if (!ok) return TaskStatus.Failure;
|
||
_started = true;
|
||
|
||
if (!m_WaitForCompletion) return TaskStatus.Success;
|
||
}
|
||
|
||
// 等待技能执行完成
|
||
return _boss.IsBossSkillExecuting ? TaskStatus.Running : TaskStatus.Success;
|
||
}
|
||
}
|
||
}
|
||
#endif
|