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.
This commit is contained in:
@@ -3,6 +3,20 @@ using UnityEngine;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
// ── 连接段类型(映射 PB2d LinkTypeName 字符串)───────────────────────
|
||||
public enum NavLinkType
|
||||
{
|
||||
None,
|
||||
Segment, // 普通地面/平台段
|
||||
Jump,
|
||||
Fall,
|
||||
Corner,
|
||||
Climb,
|
||||
Elevator,
|
||||
Teleport,
|
||||
Custom
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航代理抽象接口(架构 07_EnemyModule §5)。
|
||||
/// EnemyBase 和 BD Task 只依赖此接口,不依赖具体导航库。
|
||||
@@ -10,6 +24,7 @@ namespace BaseGames.Enemies
|
||||
/// </summary>
|
||||
public interface IPathAgent
|
||||
{
|
||||
// ── 核心移动 ────────────────────────────────────────────────────
|
||||
/// <summary>请求移动到世界坐标 target。</summary>
|
||||
void RequestMoveTo(Vector2 target);
|
||||
|
||||
@@ -28,8 +43,37 @@ namespace BaseGames.Enemies
|
||||
/// <summary>是否接近平台边缘(脚下或前方无地面时为 true)。</summary>
|
||||
bool IsNearEdge();
|
||||
|
||||
// ── 连接段感知(NavLink 平台跳跃/爬梯/传送)─────────────────────
|
||||
/// <summary>当前是否正在穿越连接段(跳跃/下落/爬梯等)。</summary>
|
||||
bool IsOnLink { get; }
|
||||
|
||||
/// <summary>当前正在穿越的连接段类型;不在连接段时为 None。</summary>
|
||||
NavLinkType CurrentLinkType { get; }
|
||||
|
||||
/// <summary>当前连接段的起始世界坐标;不在连接段时为 Vector2.zero。</summary>
|
||||
Vector2 CurrentLinkStart { get; }
|
||||
|
||||
/// <summary>当前连接段的目标世界坐标;不在连接段时为 Vector2.zero。</summary>
|
||||
Vector2 CurrentLinkEnd { get; }
|
||||
|
||||
/// <summary>检查目标是否可以从当前位置导航到达(同步轻量查询)。</summary>
|
||||
bool CanReach(Vector2 target);
|
||||
|
||||
/// <summary>移动到随机可到达点(巡逻 fallback)。</summary>
|
||||
bool WalkToRandom();
|
||||
|
||||
// ── 连接段事件 ──────────────────────────────────────────────────
|
||||
/// <summary>开始穿越连接段时触发(传入连接段类型)。</summary>
|
||||
event Action<NavLinkType> OnLinkStarted;
|
||||
|
||||
/// <summary>连接段穿越完成时触发。</summary>
|
||||
event Action<NavLinkType> OnLinkCompleted;
|
||||
|
||||
/// <summary>路径寻路失败事件(目标不可达时触发)。</summary>
|
||||
event Action OnNavPathFailed;
|
||||
|
||||
/// <summary>到达目标事件(替代轮询 IsAtDestination)。</summary>
|
||||
event Action OnGoalReached;
|
||||
}
|
||||
|
||||
// ── 无导航 / 测试用空实现 ─────────────────────────────────────────────
|
||||
@@ -41,6 +85,15 @@ namespace BaseGames.Enemies
|
||||
public void SetSpeed(float _) { }
|
||||
public bool IsMoving => false;
|
||||
public bool IsNearEdge() => false;
|
||||
public event Action OnNavPathFailed { add { } remove { } }
|
||||
public bool IsOnLink => false;
|
||||
public NavLinkType CurrentLinkType => NavLinkType.None;
|
||||
public Vector2 CurrentLinkStart => Vector2.zero;
|
||||
public Vector2 CurrentLinkEnd => Vector2.zero;
|
||||
public bool CanReach(Vector2 _) => false;
|
||||
public bool WalkToRandom() => false;
|
||||
public event Action<NavLinkType> OnLinkStarted { add { } remove { } }
|
||||
public event Action<NavLinkType> OnLinkCompleted{ add { } remove { } }
|
||||
public event Action OnNavPathFailed { add { } remove { } }
|
||||
public event Action OnGoalReached { add { } remove { } }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user