- 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.
40 lines
1.4 KiB
C#
40 lines
1.4 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:向半径内其他敌人广播警戒(Group Alert)。
|
|
///
|
|
/// 返回 Success:广播完成(不保证命中任何敌人)。
|
|
///
|
|
/// 典型用法:在 BD_SetAiPhase(Chase) 之后立即调用此节点,
|
|
/// 使发现玩家的敌人将警报传播给周围同伴,实现群体索敌效果。
|
|
///
|
|
/// 半径优先使用 m_OverrideRadius;若为 0 则读取 EnemyStatsSO.AlertBroadcastRadius。
|
|
/// </summary>
|
|
[TaskName("Broadcast Alert")]
|
|
[TaskCategory("BaseGames/Enemy/Perception")]
|
|
[TaskDescription("向附近的友方广播警报,使其进入 Alert 状态")]
|
|
public class BD_BroadcastAlert : Action
|
|
{
|
|
[Tooltip("广播半径(m);0 = 使用 EnemyStatsSO.AlertBroadcastRadius")]
|
|
[SerializeField, Min(0f)] private float m_OverrideRadius = 0f;
|
|
|
|
private EnemyBase _enemy;
|
|
|
|
public override void OnAwake() => _enemy = GetComponent<EnemyBase>();
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
if (_enemy == null) return TaskStatus.Failure;
|
|
float r = m_OverrideRadius > 0f ? m_OverrideRadius : (_enemy.StatsSO?.AlertBroadcastRadius ?? 0f);
|
|
_enemy.AlertNearby(r);
|
|
return TaskStatus.Success;
|
|
}
|
|
}
|
|
}
|
|
#endif
|