A separate class for parameters used by the level generator, different "level types" with configurable parameters

This commit is contained in:
Regalis
2016-09-12 20:18:43 +03:00
parent 1f7bf250b5
commit c6105afc80
10 changed files with 496 additions and 178 deletions
+4 -16
View File
@@ -48,28 +48,16 @@ namespace Barotrauma
get { return midPos; }
}
public WrappingWall(List<VoronoiCell> pathCells, List<VoronoiCell> mapCells, float maxY, int dir = -1)
public WrappingWall(List<VoronoiCell> pathCells, List<VoronoiCell> mapCells, Rectangle ignoredArea, int dir = -1)
{
cells = new List<VoronoiCell>();
VoronoiCell lowestPathCell = null;
foreach (VoronoiCell pathCell in pathCells)
{
if (lowestPathCell == null || pathCell.Center.Y < lowestPathCell.Center.Y)
{
lowestPathCell = pathCell;
}
}
float bottomY = Math.Max(lowestPathCell.Center.Y, maxY);
VoronoiCell edgeCell = null;
foreach (VoronoiCell cell in mapCells)
{
if (cell.Center.Y > bottomY) continue;
if (edgeCell == null
|| (dir < 0 && cell.Center.X < edgeCell.Center.X)
|| (dir > 0 && cell.Center.X > edgeCell.Center.X))
if (ignoredArea.Contains(cell.Center)) continue;
if (Math.Sign(cell.Center.X - ignoredArea.Center.X) != Math.Sign(dir)) continue;
if (edgeCell == null || cell.Center.Y < edgeCell.Center.Y)
{
edgeCell = cell;
}