EerieVillage/Assets/Scripts/Map/Generation/MapGenerator.cs

47 lines
1.5 KiB
C#
Raw Normal View History

using UnityEngine;
using EerieVillage.Map.Data;
namespace EerieVillage.Map.Generation
{
/// <summary>
/// BT13-Dev-Map Phase 2-B — 메인 절차 생성기 (Editor·Runtime 양립).
/// spec §3·§4 정합. PD 결정 3 — 매번 완전 랜덤 (Seed 입력 X).
/// </summary>
public static class MapGenerator
{
public static MapBlueprint Generate(MapGenerationConfig config)
{
if (config == null)
{
Debug.LogError("[MapGenerator] config is null");
return null;
}
// PD 결정 3 — 매번 완전 랜덤. seed = 디버그 추적용 기록만.
int seed = Random.Range(int.MinValue, int.MaxValue);
Random.InitState(seed);
var blueprint = new MapBlueprint
{
lengthTiles = config.lengthTiles,
heightTiles = 1,
generationSeed = seed
};
// 1. Chunk 분할 (Intro/Mid/BossPre 영역 — PlatformPlanner·SpawnPointPlanner 영역 내부 활용)
ChunkPlanner.Plan(config); // chunk 영역 reserved for future expansion
// 2. 지면 영역 (Perlin 변조)
GroundPlanner.Plan(config, blueprint);
// 3. 공중 발판 영역 (§6 발판 룰 + ValidateJumpReach)
PlatformPlanner.Plan(config, blueprint);
// 4. 거점·Start·Goal 영역 (§8)
SpawnPointPlanner.Plan(config, blueprint);
return blueprint;
}
}
}