создание стен как информации, ещё не обьекты
This commit is contained in:
1 parent
650af515e9
commit
bb8db47ecc
5 files changed
+174
-7
No files matched your search
@@ -123,6 +123,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
if (!ok) Debug.LogError("Лифт не помещается: проверь размеры карты, лифта и коридора");
|
||||
|
||||
AssignRoles();
|
||||
ShellBuilder.Build(_data); // сегменты стен (только данные, без спавна)
|
||||
|
||||
SpawnMarkers(); // временно
|
||||
return _data;
|
||||
@@ -133,7 +134,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
{
|
||||
foreach (var r in _data.UnassignedRooms.ToList())
|
||||
{
|
||||
var pool = r.isWallable ? ClippedRoles : FullRoles;
|
||||
var pool = r.isClipped ? ClippedRoles : FullRoles;
|
||||
r.rt = pool[Random.Range(0, pool.Length)];
|
||||
}
|
||||
}
|
||||
@@ -222,7 +223,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
lift.rt = RoomType.Lift; // тип нужно выставить ДО AddRoom, чтобы FloorData запомнил Lift
|
||||
lift.exits = new List<ExitsInRoomType>();
|
||||
lift.entrance = ToEntrance(dir);
|
||||
lift.isWallable = false;
|
||||
lift.isClipped = false;
|
||||
|
||||
_data.AddRoom(lift, liftDepth);
|
||||
_parent[lift] = (parent, dir);
|
||||
@@ -432,7 +433,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
newRoom.entrance = ToEntrance(dir);
|
||||
|
||||
if (!FitRoom(prevRoom, newRoom, dir, out bool shrunk)) return false;
|
||||
newRoom.isWallable = shrunk;
|
||||
newRoom.isClipped = shrunk;
|
||||
|
||||
// Пересечения: комната (с зазором, без prevRoom) и коридор к ней
|
||||
RectInt roomArea = Inflate(RoomRect(newRoom), Mathf.Min(_margin, _corrLen));
|
||||
@@ -568,6 +569,14 @@ namespace _Project.Scripts.LevelGenerating
|
||||
Vector3 c = LevelGrid.ToWorld(r.Center);
|
||||
Gizmos.DrawWireCube(c, new Vector3(r.Length * LevelGrid.Module, 0.1f, r.Width * LevelGrid.Module));
|
||||
}
|
||||
|
||||
// Сегменты стен: чёрные - стена, красные - угол
|
||||
foreach (var s 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user