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:
2026-05-23 19:10:29 +08:00
parent 81c326af53
commit a1b4e629aa
165 changed files with 7904 additions and 313 deletions

View File

@@ -20,6 +20,17 @@ namespace BaseGames.Enemies
public int Defense { get; private set; }
public float AttackCooldownTimer { get; private set; }
// ── 移动速度(透传 SO供 BD 任务运行时读取)────────────────────────
public float WalkSpeed => _config?.WalkSpeed ?? 2f;
public float RunSpeed => _config?.RunSpeed ?? 4f;
// ── AI 追击配置(透传 SO──────────────────────────────────────────
public float MaxChaseDistance => _config?.MaxChaseDistance ?? 15f;
public float LoseLinkTimeout => _config?.LoseLinkTimeout ?? 2f;
public float AlertDuration => _config?.AlertDuration ?? 0.6f;
public float InvestigateDuration => _config?.InvestigateDuration ?? 3f;
public float HomeRadius => _config?.HomeRadius ?? 0.5f;
/// <summary>
/// 每帧由 EnemyBase 更新sqrMagnitude避免 sqrt 开销)。
/// 使用方请与 range*range 比较,而非直接与 range 比较。
@@ -59,9 +70,10 @@ namespace BaseGames.Enemies
{
if (_config == null) return;
var scaler = ServiceLocator.GetOrDefault<IDifficultyService>()?.CurrentScaler;
MaxHP = scaler != null
? Mathf.Max(1, Mathf.RoundToInt(_config.MaxHP * scaler.EnemyHPMultiplier))
int raw = scaler != null
? Mathf.RoundToInt(_config.MaxHP * scaler.EnemyHPMultiplier)
: _config.MaxHP;
MaxHP = Mathf.Max(1, raw); // 防止 MaxHP=0 导致 HP 比例计算 NaN
}
public void TakeDamage(int amount)