Files
zeling_v2/Assets/_Game/Scripts/Enemies/AI/BD_UseBossSkillWeighted.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

55 lines
1.9 KiB
C#
Raw 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.
#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。关闭后执行开始即返回 SuccessBT 继续运行其他节点。")]
[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