示例#1
0
        public void CreateColonies(IEnumerable <Player> owningPlayers)
        {
            if (owningPlayers.Count() == 0)
            {
                return;
            }

            //PSystem sol = _galaxyManager.Systems.Find(ss => ss.Id == _dbFiller.gp.SolID);

            var areaList = _galaxyManager.GetAllAreas();

            string resultMessage = "";

            var itr = new CyclicalIterator <Player>(owningPlayers);

            itr.MoveNext();

            for (int i = 0; i < areaList.Count; i++)
            {
                if (areaList[i].AreaType != AreaTypes.Planet)
                {
                    continue;
                }

                var xPos = ((Planet)areaList[i]).Warpholes[0].PosX + 1;
                var yPos = ((Planet)areaList[i]).Warpholes[0].PosY + 1;

                var player = itr.Current;
                var ship   = player.GetActiveShip();

                var success = _galaxyManager.TryColonizePlanet((Planet)areaList[i], ship, null, _locatorService, xPos, yPos,
                                                               out resultMessage, _databaseManager);

                itr.MoveNext();
            }
        }