- 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.
36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
#if GRAPH_DESIGNER
|
||
using UnityEngine;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals;
|
||
using BaseGames.Enemies;
|
||
|
||
namespace BaseGames.Enemies.AI
|
||
{
|
||
/// <summary>
|
||
/// 条件:目标坐标从当前位置是否可到达(调用 NavAgent.CanReach,无法寻路时 Failure)。
|
||
/// 用于 Boss 阶段切换或小怪决策能否追击到跨平台目标。
|
||
/// </summary>
|
||
[TaskName("Can Reach Target?")]
|
||
[TaskCategory("BaseGames/Enemy/Perception")]
|
||
[TaskDescription("检查 NavAgent 是否可以规划到目标的有效路径")]
|
||
public sealed class BD_CanReachTarget : Conditional
|
||
{
|
||
[Tooltip("检查目标(留空则使用玩家位置)")]
|
||
[SerializeField] private Transform m_Target;
|
||
|
||
private EnemyBase _enemy;
|
||
|
||
public override void OnAwake() => _enemy = gameObject.GetComponent<EnemyBase>();
|
||
|
||
public override TaskStatus OnUpdate()
|
||
{
|
||
if (_enemy?.Nav == null) return TaskStatus.Failure;
|
||
Vector2 pos = m_Target != null
|
||
? (Vector2)m_Target.position
|
||
: _enemy.PlayerTransform != null ? (Vector2)_enemy.PlayerTransform.position : Vector2.zero;
|
||
return _enemy.Nav.CanReach(pos) ? TaskStatus.Success : TaskStatus.Failure;
|
||
}
|
||
}
|
||
}
|
||
#endif
|