Exemple #1
0
        public void CreateColony(Tile tile, int population)
        {
            var colony = new Colony(Nation, tile, population);

            tile.OwnedBy = colony;
            Colonies.Add(colony);
        }
Exemple #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);
        }
Exemple #3
0
 public void AddColony(ColonyData pc)
 {
     if (CapitalColony == null)
     {
         CapitalColony = pc;
     }
     Colonies.Add(pc);
 }
Exemple #4
0
        public void MoveToColony(Tile tile, int population)
        {
            var colony = Colonies.Where(c => c.Tile == tile).First();

            colony.Population += population;
            if (colony.Population > MaximumPopulationInColony)
            {
                colony.Population = MaximumPopulationInColony;
            }
        }
Exemple #5
0
 /// <summary>
 /// Clear all stored data.
 /// </summary>
 private void Clear()
 {
     StructuresSelf.Clear();
     WorkersSelf.Clear();
     UnitsSelf.Clear();
     StructureEnemy.Clear();
     WorkersEnemy.Clear();
     UnitsEnemy.Clear();
     Colonies.Clear();
     PrimaryColony = null;
     UpgradesSelf.Clear();
     MineralFields.Clear();
     VespeneGeysers.Clear();
     Destructibles.Clear();
     XelNagaTowers.Clear();
     Handler = new CaseHandler <Case, IUnit>();
 }
Exemple #6
0
 public void DestroyColony(Tile tile)
 {
     Colonies.Remove(Colonies.Where(colony => colony.Tile == tile).First());
     tile.OwnedBy = null;
 }
 public override int GetHashCode()
 {
     return(Colonies.GetHashCode() + Population.GetHashCode() * 31 + Infrastructure.GetHashCode() * 967);
 }
Exemple #8
0
 public override int GetHashCode()
 {
     return(Colonies.GetHashCode() + this.Population.GetHashCode() * 31);
 }