Пример #1
0
        public Ant(int x, int y, AntHill a)
            : base(x,y, "Ant")
        {
            hasFood = false;
            status = "";
            anthill = a;
            ant_id = init_id++;
            nearestFood = null;

            hasObjects = false;

            current_job = new Job();
        }
Пример #2
0
 private bool HasFullGuard(AntHill hill, out Direction8 emptySpot)
 {
     foreach (Direction8 direction in Enum.GetValues(typeof(Direction8)))
     {
         if (gameState.GetIsUnoccupied(gameState.GetDestination(hill, direction)))
         {
             emptySpot = direction;
             return(false);
         }
     }
     emptySpot = Direction8.North;
     return(true);
 }
Пример #3
0
        public void AntHill(int row, int col, int team)
        {
            AntHill hill = new AntHill(row, col, team);

            map[col, row].isActiveHill = true;
            if (team == 0)
            {
                MyHills.Add(hill);
                map[col, row].isMyHill = true;
            }
            else
            {
                EnemyHills.Add(hill);
                map[col, row].isEnemyHill = true;
            }
        }
Пример #4
0
        public void AntHill(int row, int col, int team)
        {
            if (map[row, col] == Tile.Land)
            {
                map[row, col] = Tile.Hill;
            }

            AntHill hill = new AntHill(row, col, team);

            if (team == 0)
            {
                MyHills.Add(hill);
            }
            else
            {
                EnemyHills.Add(hill);
            }
        }
Пример #5
0
        public void AntHill(int row, int col, int team)
        {
            if (map[row, col] == Tile.Land) {
                map[row, col] = Tile.Hill;
            }

            AntHill hill = new AntHill (row, col, team);
            if (team == 0)
                MyHills.Add (hill);
            else
                EnemyHills.Add (hill);
        }
Пример #6
0
        private void init()
        {
            anthill = new AntHill(10,10);
            stuff.Add(anthill);
            anthill2 = new AntHill(width-1, height-1);
            stuff.Add(anthill2);

            anthill.enemyHill = anthill2;
            anthill2.enemyHill = anthill;

            Random joe = new Random();
            for(int i = 0; i < width; i++)
            {
                for(int j = 0; j < height; j++)
                {
                    m_world[i,j] = '_';
                }
            }

            int x,y;

            for(int i = 0; i < num_food; i++)
            {
                x = joe.Next()%width;
                y = joe.Next()%height;
                foodz.Add(new Food(x, y));
                //stuff.Add(new Food(x, y));
            }
        }
        public static void AddAntHill(int row, int col, int team)
        {
            GameObject[] objects = map[row, col].GetObjectsOnTile();
            for (int i = 0; i < objects.Length; i++)
            {
                AntHill a = objects[i] as AntHill;
                if (a != null)
                {
                    a.StaleLength = 0;
                    return;
                }
            }

            AntHill hill = new AntHill(row, col, team);
            if (team == 0)
                MyHills.Add(hill);
            else
                EnemyHills.Add(hill);
        }
Пример #8
0
 public void setEnemyHill(AntHill k)
 {
     enemyHill = k;
 }