Exemple #1
0
    public void Init(List <Region> regions)
    {
        Name    = "Continent XYZ";
        Regions = regions;
        Size    = regions.Count;
        Area    = regions.Sum(x => x.Area);

        List <List <Region> > clusters = PolygonMapFunctions.FindClusters(regions);

        foreach (List <Region> cluster in clusters)
        {
            List <GameObject> clusterBorders = MeshGenerator.CreatePolygonGroupBorder(cluster.Select(x => x.Polygon).ToList(), PolygonMapGenerator.DefaulContinentBorderWidth, Color.black, onOutside: false, yPos: PolygonMapGenerator.LAYER_CONTINENT);
            foreach (GameObject clusterBorder in clusterBorders)
            {
                Borders.Add(clusterBorder);
            }
        }
        foreach (GameObject border in Borders)
        {
            border.transform.SetParent(transform);
        }
    }
Exemple #2
0
    public void UpdateProperties()
    {
        DestroyAllObjects();
        if (Regions.Count == 0)
        {
            return;
        }

        // Border
        Area     = Regions.Sum(x => x.Area);
        Clusters = PolygonMapFunctions.FindClusters(Regions);
        foreach (List <Region> cluster in Clusters)
        {
            List <GameObject> clusterBorders = MeshGenerator.CreatePolygonGroupBorder(cluster.Select(x => x.Polygon).ToList(), PolygonMapGenerator.DefaultShorelineBorderWidth, SecondaryColor, onOutside: false, yPos: 0.0002f);
            foreach (GameObject clusterBorder in clusterBorders)
            {
                Borders.Add(clusterBorder);
            }
        }

        // Label
        Label();
    }