コード例 #1
0
ファイル: Player.cs プロジェクト: GintV/population-wars
        public void CreateColony(Tile tile, int population)
        {
            var colony = new Colony(Nation, tile, population);

            tile.OwnedBy = colony;
            Colonies.Add(colony);
        }
コード例 #2
0
        private void InitializeColonies()
        {
            var colonyPosition = new Vector2f(0, 0);

            int intCPosX  = (int)colonyPosition.X;
            int intCposY  = (int)colonyPosition.Y;
            var chunkSize = Chunk <Cell> .SIZE;

            //Generate four chunks around colony;
            Smells[intCPosX, intCposY].Item                         = null;
            Smells[intCPosX - chunkSize, intCposY].Item             = null;
            Smells[intCPosX, intCposY - chunkSize].Item             = null;
            Smells[intCPosX - chunkSize, intCposY - chunkSize].Item = null;

            var queen = AntsFactory.CreateQueen();

            queen.Position = colonyPosition;
            engine.Register(queen);
            var colony = new Colony(0, colonyPosition, queen);

            for (int i = 0; i < 100; i++)
            {
                var ant = AntsFactory.CreateWorker();
                ant.Position = colonyPosition;
                colony.Ants.Add(ant);
                engine.Register(ant);
            }
            Colonies.Add(colony);
        }
コード例 #3
0
 public void AddColony(ColonyData pc)
 {
     if (CapitalColony == null)
     {
         CapitalColony = pc;
     }
     Colonies.Add(pc);
 }