Exemple #1
0
        public BuildingTownRoads(List <Town> townList, ShrunkNode[,] shrunkMap, List <ShrunkPlot> shrunkPlotList, LoadingInfo loadingInfo)
        {
            float percentDone = 0;
            float percentJump = 100f / townList.Count;

            loadingInfo.UpdateLoading(LoadingType.ExpandingTowns, percentDone);
            Point workingPoint;

            //'' for (int townSiteId = 0; townSiteId < townList.Count; townSiteId++)
            foreach (Town town in townList)
            {
                //set the Id here
                List <ConnectingPoint> connectingPointsList = new List <ConnectingPoint>();
                numberOfRoads = GameController.rnd.Next(CreatingWorld.minTownRoads, CreatingWorld.maxTownRoads);
                workingPoint  = town.GetShrunkPoint();
                BuildTownCenterPoints(workingPoint, connectingPointsList, town.id, shrunkMap, shrunkPlotList);

                for (int p = 0; p < numberOfRoads; p++)
                {
                    stopRoadCount = 4;
                    if (connectingPointsList.Count > 0)
                    {
                        ConnectingPoint connectingPoint = connectingPointsList[0];
                        workingPoint = connectingPoint.connectingPoint;
                        LayRoadStretch(workingPoint, connectingPoint.directionToTravel, connectingPoint.distanceToTravel, town.id, connectingPointsList, shrunkMap, shrunkPlotList);
                        connectingPointsList.RemoveAt(0);
                    }
                }
                percentDone += percentJump;
                loadingInfo.UpdateLoading(LoadingType.ExpandingTowns, percentDone);
            }
        }
Exemple #2
0
 public ConnectingPoint(double x, double y, ConnectingPoint previous)
 {
     this.X        = x;
     this.Y        = y;
     this.previous = previous;
     this.next     = null;
 }