public static HiveMap InitiateMap(int dimensions)
        {
            HiveMap map       = new HiveMap(dimensions);
            Cell    queenCell = map.GetCell(dimensions / 2, dimensions / 2);

            queenCell.Ant = new Queen(queenCell);
            queenCell.PrintCoords();
            //why i cannot acces queen methods when queenCell.Ant = new Queen(..)
            queenCell.Ant.GenerateAnts(ref map);
            return(map);
        }
예제 #2
0
        public override void GenerateAnts(ref HiveMap map)
        {
            List <string> listOfPopulatedFields = PopulateList(map.Dimensions);
            int           listCounter           = 0;

            for (int x = 0; x < map.Dimensions; x++)
            {
                for (int y = 0; y < map.Dimensions; y++)
                {
                    Cell cell = map.GetCell(x, y);
                    if (!cell.Ant?.IsNotPassable ?? true)
                    {
                        Console.WriteLine("wpadl queen if");
                        switch (listOfPopulatedFields[listCounter])
                        {
                        case "drone":
                            cell.Ant = new Drone(cell);
                            Console.WriteLine("Drone created");
                            cell.PrintCoords();
                            break;

                        case "worker":
                            cell.Ant = new Worker(cell);
                            Console.WriteLine("Worker created");
                            cell.PrintCoords();
                            break;

                        case "soldier":
                            cell.Ant = new Soldier(cell);
                            Console.WriteLine("Soldier created");
                            cell.PrintCoords();
                            break;
                        }
                    }
                    listCounter++;
                }
            }
        }