Есть генерация стен, пола, потолка и разбиения мешей на комнаты
This commit is contained in:
1 parent
bb8db47ecc
commit
746cbb2b5e
405 files changed
+24202
-98
No files matched your search
@@ -31,6 +31,8 @@ namespace _Project.Scripts.LevelGenerating
|
||||
[SerializeField] private float _minDistanceStartLift; // метры
|
||||
[SerializeField] private GameObject GameObjectA;
|
||||
[SerializeField] private GameObject GameObjectB;
|
||||
[SerializeField] private ShellSpawner shellSpawner; // если назначен, строит пол, стены и потолок
|
||||
[SerializeField] private RoomGeneratorRegistry roomGenerators; // оформляет комнаты по темам (материалы, свет)
|
||||
|
||||
[Header("Генерация")]
|
||||
[SerializeField] private int maxRooms = 15;
|
||||
@@ -123,9 +125,15 @@ namespace _Project.Scripts.LevelGenerating
|
||||
if (!ok) Debug.LogError("Лифт не помещается: проверь размеры карты, лифта и коридора");
|
||||
|
||||
AssignRoles();
|
||||
ShellBuilder.Build(_data); // сегменты стен (только данные, без спавна)
|
||||
ShellBuilder.Build(_data); // отрезки стен (только данные)
|
||||
|
||||
SpawnMarkers(); // временно
|
||||
if (shellSpawner != null)
|
||||
{
|
||||
var shell = shellSpawner.Spawn(_data); // меши: пол, потолок, стены по комнатам
|
||||
if (shell != null && roomGenerators != null)
|
||||
roomGenerators.Run(shell, _data); // оформление каждой комнаты (материалы, свет)
|
||||
}
|
||||
else SpawnMarkers(); // временно, если спавнер не назначен
|
||||
return _data;
|
||||
}
|
||||
|
||||
@@ -570,12 +578,13 @@ namespace _Project.Scripts.LevelGenerating
|
||||
Gizmos.DrawWireCube(c, new Vector3(r.Length * LevelGrid.Module, 0.1f, r.Width * LevelGrid.Module));
|
||||
}
|
||||
|
||||
// Сегменты стен: чёрные - стена, красные - угол
|
||||
foreach (var s in _data.Walls)
|
||||
// Отрезки стен: чёрные линии на высоте 1 м
|
||||
Gizmos.color = Color.black;
|
||||
foreach (var w in _data.Walls)
|
||||
{
|
||||
Gizmos.color = s.Kind == SegmentKind.Corner ? Color.red : Color.black;
|
||||
Vector3 pos = LevelGrid.ToWorld(new Vector2(s.Cell.x + 0.5f, s.Cell.y + 0.5f), 0.5f);
|
||||
Gizmos.DrawCube(pos, new Vector3(LevelGrid.Module, 1f, LevelGrid.Module) * 0.9f);
|
||||
bool alongX = w.Facing == WallFacing.ZP || w.Facing == WallFacing.ZN;
|
||||
Vector2Int end = w.Start + (alongX ? new Vector2Int(w.Length, 0) : new Vector2Int(0, w.Length));
|
||||
Gizmos.DrawLine(LevelGrid.ToWorld(w.Start, 1f), LevelGrid.ToWorld(end, 1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user