Checkpoint 2:

- 调整 SimulationWorld 作为 GameFrameworkComponent 组件
- ProcedureGame 接入 SimulationWorld 生命周期(创建/清理)并在敌人 Show/Hide 时同步注册/反注册
- 增加 EnemySimData 构建与缓存去重移除,避免重复注册和悬空映射
- SimulationWorld 增加 UpsertEnemy/UpsertProjectile/UpsertPickup,支持幂等注册
This commit is contained in:
SepComet
2026-02-20 18:47:00 +08:00
parent 3b8e0731f0
commit 83f8a356f7
6 changed files with 187 additions and 20 deletions
@@ -6,6 +6,7 @@
//------------------------------------------------------------
using CustomComponent;
using Simulation;
using StarForce;
using UI;
using UnityEngine;
@@ -20,12 +21,15 @@ public partial class GameEntry : MonoBehaviour
public static HPBarComponent HPBar { get; private set; }
public static DamageTextComponent DamageText { get; private set; }
#if UNITY_EDITOR || DEVELOPMENT_BUILD
public static RuntimeDebugPanelComponent RuntimeDebugPanel { get; private set; }
#endif
public static EnemyManagerComponent EnemyManager { get; private set; }
public static SimulationWorld SimulationWorld { get; private set; }
public static SpriteCacheComponent SpriteCache { get; private set; }
public static UIRouterComponent UIRouter { get; private set; }
@@ -35,19 +39,14 @@ public partial class GameEntry : MonoBehaviour
BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent<BuiltinDataComponent>();
HPBar = UnityGameFramework.Runtime.GameEntry.GetComponent<HPBarComponent>();
DamageText = UnityGameFramework.Runtime.GameEntry.GetComponent<DamageTextComponent>();
if (DamageText == null && Base != null)
{
DamageText = Base.gameObject.AddComponent<DamageTextComponent>();
}
#if UNITY_EDITOR || DEVELOPMENT_BUILD
RuntimeDebugPanel = UnityGameFramework.Runtime.GameEntry.GetComponent<RuntimeDebugPanelComponent>();
if (RuntimeDebugPanel == null && Base != null)
{
RuntimeDebugPanel = Base.gameObject.AddComponent<RuntimeDebugPanelComponent>();
}
#endif
EnemyManager = UnityGameFramework.Runtime.GameEntry.GetComponent<EnemyManagerComponent>();
SimulationWorld = UnityGameFramework.Runtime.GameEntry.GetComponent<SimulationWorld>();
SpriteCache = UnityGameFramework.Runtime.GameEntry.GetComponent<SpriteCacheComponent>();
UIRouter = UnityGameFramework.Runtime.GameEntry.GetComponent<UIRouterComponent>();
}
}
}