コード例 #1
0
        public void AddRoads(List <PopulationCentre> popCentres, List <RoadType> roadTypes)
        {
            var links = getPopCenterConnections(popCentres);
            var types = roadTypes.OrderByDescending(x => x.weightRequirement);

            foreach (var link in links)
            {
                if (link.weight < 2)
                {
                    if ((link.node1.position - link.node2.position).Length > 200)
                    {
                        continue;
                    }
                }
                TerrainType roadType = types.First(x => x.weightRequirement < link.weight);
                var         path     = solvePath(link.node1, link.node2);
                roadNetwork.Add(path, roadType);
                //yield return new List<RoadSegment>(roadNetwork.roadSegments);
            }
        }