Add enemy respawner and related components for room lifecycle management
- Implemented EnemyRespawner to manage enemy spawning and respawning within rooms. - Added IRoomLifecycle interface for room activation and dormancy handling. - Created supporting classes and metadata for enemy perception and threat assessment. - Established streaming system components for room state management and transitions. - Added necessary metadata files for new scripts to ensure proper integration with Unity.
This commit is contained in:
@@ -388,8 +388,35 @@ namespace BaseGames.Editor
|
||||
roomSO.ApplyModifiedPropertiesWithoutUndo();
|
||||
}
|
||||
|
||||
// ── MapRoomDataSO 模板(幂等:同名资产已存在时跳过)──────────────
|
||||
string roomIdHint = SceneManager.GetActiveScene().name;
|
||||
if (string.IsNullOrEmpty(roomIdHint) || roomIdHint == "Untitled")
|
||||
roomIdHint = "Room_Unknown";
|
||||
|
||||
string roomSoFolder = "Assets/_Game/Data/Map/Rooms";
|
||||
string roomSoPath = $"{roomSoFolder}/{roomIdHint}.asset";
|
||||
|
||||
bool roomSoCreated = false;
|
||||
if (!System.IO.File.Exists(Application.dataPath + "/../" + roomSoPath))
|
||||
{
|
||||
EnsureFolder(roomSoFolder);
|
||||
var roomData = ScriptableObject.CreateInstance<MapRoomDataSO>();
|
||||
roomData.RoomId = roomIdHint;
|
||||
roomData.RegionId = roomIdHint.Contains("_")
|
||||
? roomIdHint.Split('_')[1]
|
||||
: "";
|
||||
AssetDatabase.CreateAsset(roomData, roomSoPath);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
roomSoCreated = true;
|
||||
}
|
||||
|
||||
// ── Report ─────────────────────────────────────────────────────
|
||||
report.Add("在 RoomController._roomId 填写唯一房间 ID(如 \"Room_Forest_01\")。");
|
||||
if (roomSoCreated)
|
||||
report.Add($"已自动创建 MapRoomDataSO 模板:{roomSoPath}。请填写 GridPosition / GridSize / Exits,并将其添加到 MapDatabaseSO.AllRooms 中。");
|
||||
else
|
||||
report.Add($"MapRoomDataSO 已存在({roomSoPath}),请确认其 RoomId / Exits 与场景保持同步。");
|
||||
report.Add("绑定 LensConfig SO 后单击 Inspector 中「从可视区域更新限位区域」计算正确的 BoxCollider。");
|
||||
report.Add("使用 Tile Palette 在 Ground Tilemap 上绘制地形,然后在 NavSurface Inspector 中点击 Bake。");
|
||||
report.Add("[Transitions] 子节点下使用 BaseGames/Scene/Place/Room Transition 添加过渡点。");
|
||||
@@ -427,9 +454,10 @@ namespace BaseGames.Editor
|
||||
AssignReference(streamingMgr, "_budget", budgetConfig);
|
||||
AssignAsset(streamingMgr, "_onRoomEntered", report, false, "EVT_RoomEntered");
|
||||
AssignAsset(streamingMgr, "_onRoomPreloaded", report, false, "EVT_RoomPreloaded");
|
||||
AssignAsset(streamingMgr, "_onRoomActivated", report, false, "EVT_RoomActivated");
|
||||
|
||||
// ── TransitionDirector 字段 ───────────────────────────────────────
|
||||
AssignReference(transitionDir, "_streamingManager", streamingMgr);
|
||||
AssignReference(transitionDir, "_streamingManagerRef", streamingMgr);
|
||||
AssignReference(transitionDir, "_mapDatabase", mapDbAsset);
|
||||
AssignReference(transitionDir, "_budget", budgetConfig);
|
||||
AssignAsset(transitionDir, "_onFadeOutRequest", report, false, "EVT_FadeOutRequest");
|
||||
|
||||
Reference in New Issue
Block a user