public LevelWall(List<Vector2> edgePositions, Vector2 extendAmount, Color color, Level level) { cells = new List<VoronoiCell>(); for (int i = 0; i < edgePositions.Count - 1; i++) { Vector2[] vertices = new Vector2[4]; vertices[0] = edgePositions[i]; vertices[1] = edgePositions[i + 1]; vertices[2] = vertices[0] + extendAmount; vertices[3] = vertices[1] + extendAmount; VoronoiCell wallCell = new VoronoiCell(vertices); wallCell.CellType = CellType.Edge; wallCell.Edges[0].Cell1 = wallCell; wallCell.Edges[1].Cell1 = wallCell; wallCell.Edges[2].Cell1 = wallCell; wallCell.Edges[3].Cell1 = wallCell; wallCell.Edges[0].IsSolid = true; if (i > 1) { wallCell.Edges[3].Cell2 = cells[i - 1]; cells[i - 1].Edges[1].Cell2 = wallCell; } cells.Add(wallCell); } body = CaveGenerator.GeneratePolygons(cells, level, out List<Vector2[]> triangles); body.CollisionCategories = Physics.CollisionLevel; #if CLIENT List<VertexPositionTexture> bodyVertices = CaveGenerator.GenerateRenderVerticeList(triangles); SetBodyVertices(bodyVertices.ToArray(), color); SetWallVertices(CaveGenerator.GenerateWallShapes(cells, level), color); #endif }
public float GetCommonness(Level level) { return(Commonness.ContainsKey(level.GenerationParams.Name) ? Commonness[level.GenerationParams.Name] : Commonness[""]); }