public Map Generate(Vector2 dimensions, int generations, PolygonList.FaceType faceType, EnvironmentConstructionScript.FunctionType functionType, float height, AnimationCurve heightMap, int regionCount, int relaxationCount, float radius) { data = new Map(); data.generations = generations; this.height = height; this.heigtMap = heightMap; islandShape = new EnvironmentConstructionScript(generations, dimensions.x, dimensions.y, functionType); rectangle = new Rectangle(0, 0, dimensions.x, dimensions.y); if (faceType == PolygonList.FaceType.Hexagon || faceType == PolygonList.FaceType.Square) { relaxationCount = 0; // relaxation is used to create accurate polygon size } // no specific value for rectangle - able to resize in the editor Polygon polygon = PolygonList.Create(dimensions, generations, faceType, regionCount, radius); VoronoiBase voronoi = GenerateVoronoi(ref polygon, relaxationCount); Build(polygon, voronoi); ImproveBorders(); // Determine the elevations and water at Voronoi corners. Elevation.AssignCorner(ref data, islandShape, faceType == PolygonList.FaceType.Hexagon || faceType == PolygonList.FaceType.Square); // Determine polygon and corner type: ocean, coast, land. CheckingScript.AssignSeaSealandAndLand(ref data); // Rescale elevations so that the highest is 1.0, and they're // distributed well. Lower elevations will be more common // than higher elevations. List <Characteristics.Corner> corners = LandCorners(data.corners); Elevation.Readjust(ref corners); // elevations assigned to water corners foreach (var q in data.corners) { if (q.sea || q.sealine) { q.built = 0.0f; } } // Polygon elevations are the average of their corners Elevation.AllocatePolygon(ref data); // Determine humidity at corners, starting at rivers // and lakes, but not oceans. Then redistribute // humidity to cover the entire range evenly from 0.0 // to 1.0. Then assign polygon humidity as the average // of the corner humidity. Humidity.AccountEdge(ref data); Humidity.Redistribute(ref corners); Humidity.AssignPolygon(ref data); CheckingScript.AssignHabitat(ref data); return(data); }