65 lines
2.4 KiB
C#
65 lines
2.4 KiB
C#
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using EerieVillage.Map.Data;
|
||
|
|
|
||
|
|
namespace EerieVillage.Map.Generation
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// BT13-Dev-Map Phase 2-B — 청크 분할 Planner.
|
||
|
|
/// spec §4-4 정합. Intro·Mid·BossPre 영역 3등분.
|
||
|
|
/// PD §15 OVERRIDE (2026-05-18):
|
||
|
|
/// §15-3 — 기본 고정·EditorWindow 미노출
|
||
|
|
/// §15-9 OVERRIDE — Boss Room 자동 생성 (맵 우측 끝·bossRoomEnabled=true 영역)
|
||
|
|
/// </summary>
|
||
|
|
public static class ChunkPlanner
|
||
|
|
{
|
||
|
|
public struct ChunkInfo
|
||
|
|
{
|
||
|
|
public int startX;
|
||
|
|
public int endX;
|
||
|
|
public ChunkTemplate.ChunkRole role;
|
||
|
|
public bool isBossRoom; // §15-9 OVERRIDE
|
||
|
|
}
|
||
|
|
|
||
|
|
public static List<ChunkInfo> Plan(MapGenerationConfig config)
|
||
|
|
{
|
||
|
|
var chunks = new List<ChunkInfo>();
|
||
|
|
if (config == null) return chunks;
|
||
|
|
int length = config.lengthTiles;
|
||
|
|
int chunkSize = Mathf.Max(5, config.chunkSizeTiles);
|
||
|
|
|
||
|
|
// §15-9 OVERRIDE — BossRoom 청크 영역 영역 (마지막 영역 영역).
|
||
|
|
// BossRoom 영역 = lengthTiles - bossRoomLengthTiles ~ lengthTiles
|
||
|
|
// 본 영역 영역 Mid/BossPre 청크 영역 영역 영역 영역 영역.
|
||
|
|
int bossRoomStart = config.bossRoomEnabled
|
||
|
|
? length - config.bossRoomLengthTiles
|
||
|
|
: length;
|
||
|
|
|
||
|
|
for (int x = 0; x < bossRoomStart; x += chunkSize)
|
||
|
|
{
|
||
|
|
int endX = Mathf.Min(x + chunkSize, bossRoomStart);
|
||
|
|
float ratio = (float)x / bossRoomStart;
|
||
|
|
ChunkTemplate.ChunkRole role;
|
||
|
|
if (ratio < 0.33f) role = ChunkTemplate.ChunkRole.Intro;
|
||
|
|
else if (ratio < 0.66f) role = ChunkTemplate.ChunkRole.Mid;
|
||
|
|
else role = ChunkTemplate.ChunkRole.BossPre;
|
||
|
|
|
||
|
|
chunks.Add(new ChunkInfo { startX = x, endX = endX, role = role, isBossRoom = false });
|
||
|
|
}
|
||
|
|
|
||
|
|
// §15-9 OVERRIDE — BossRoom 청크 (역할 BossPre 재사용·isBossRoom=true)
|
||
|
|
if (config.bossRoomEnabled)
|
||
|
|
{
|
||
|
|
chunks.Add(new ChunkInfo
|
||
|
|
{
|
||
|
|
startX = bossRoomStart,
|
||
|
|
endX = length,
|
||
|
|
role = ChunkTemplate.ChunkRole.BossPre,
|
||
|
|
isBossRoom = true
|
||
|
|
});
|
||
|
|
}
|
||
|
|
return chunks;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|