Ejemplo n.º 1
0
 public Board(int sizeX, int sizeY)
 {
     grids = new GameGrid[sizeX, sizeY];
     for (int i = 0; i < sizeX; i++)
     {
         for (int j = 0; j < sizeY; j++)
         {
             grids[i, j] = new GameGrid()
             {
                 type = GameGrid.GridType.Normal, doll = null, supply = 0
             };
         }
     }
 }
Ejemplo n.º 2
0
        public bool DeployDoll(Doll doll, Faction faction)
        {
            GameGrid hq = null;

            for (int i = 0; i < board.grids.GetLength(0); i++)
            {
                for (int j = 0; j < board.grids.GetLength(1); j++)
                {
                    if (board[i, j].type == GameGrid.GridType.HQ && board[i, j].faction == factions[currentFactionIndex])
                    {
                        hq = board[i, j];
                    }
                }
            }
            if (hq == null || hq.doll != null || factions[currentFactionIndex].supply < Doll.deployCost[(int)doll.type])
            {
                return(false);
            }

            factions[currentFactionIndex].supply -= Doll.deployCost[(int)doll.type];
            hq.doll = doll;
            return(true);
        }