Ejemplo n.º 1
0
 public void SetArea(PlayerArea area)
 {
     if (Area == null)
     {
         Area = area;
     }
 }
Ejemplo n.º 2
0
 public void SetArea(PlayerArea area)
 {
     if (Area == null) 
     {
         Area = area;
     }
 }
Ejemplo n.º 3
0
        public void InitialStandards()
        {

            Dictionary<int, FastList<City>> startAreas = new Dictionary<int, FastList<City>>();
            for (int i = 0; i < battleField.CityCount; i++)
            {
                City cc = battleField.Cities[i];
                if (cc.StartUp != -1)
                {
                    FastList<City> list;
                    if (!startAreas.TryGetValue(cc.StartUp, out list))
                    {
                        list = new FastList<City>();
                        startAreas.Add(cc.StartUp, list);
                    }

                    list.Add(cc);
                }
            }

            #region 确定玩家起始城市
            ExistTable<int> startAreaTable = new ExistTable<int>(startAreas.Count);

            for (int i = 0; i < localPlayerArea.Length; i++)
            {
                localPlayerArea[i] = new PlayerArea(battleField, localPlayers[i]);

                if (localPlayers[i].Type == PlayerType.LocalHuman)
                    LocalHumanPlayer = localPlayers[i];

                localPlayers[i].SetArea(localPlayerArea[i]);
                localPlayers[i].SetParent(this);



                bool finished = false;
                while (!finished)
                {
                    int area = Randomizer.GetRandomInt(startAreas.Count) + 1;

                    if (!startAreaTable.Exists(area))
                    {
                        startAreaTable.Add(area);
                        FastList<City> list = startAreas[area];

                        int cidx = Randomizer.GetRandomInt(list.Count);
                        list[cidx].IsHomeCity = true;
                        list[cidx].ChangeOwner(localPlayers[i]);

                        //list[cidx].TestBalls();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        //if (localPlayers[i].Type == PlayerType.LocalHuman)
                        //{
                        //    for (int k = 0; k < 20; k++)
                        //        list[cidx].ProduceBall();
                        //}

                        finished = true;
                    }
                }
            }
            #endregion

        }
Ejemplo n.º 4
0
        public AIDecision(BattleField world, AIPlayer player)
        {
            this.world = world;
            this.player = player;
            this.area = player.Area;


            helper = new AIDecisionHelper(world);

            area.NewCity += PlayerArea_NewCity;
            area.LostCity += PlayerArea_RemoveCity;

        }