Beispiel #1
0
        /// <summary>
        /// Met les Tiles possibles "Selected"
        /// </summary>
        /// <param name="board">Le plateau</param>
        /// <param name="move">Les coordonnées des destinations possibles de la balle</param>
        private void setSelectedPossibleTile(Board board, int[] move)
        {
            board.unSelectedAllTile();
            int i = 0;

            do
            {
                board.getTile(move[i], move[i + 1]).setSelected();
                i += 2;
            } while (i < 16 && move[i] != -1 && move[i] != -1);
        }
Beispiel #2
0
 /// <summary>
 /// Execute la commande
 /// </summary>
 /// <param name="board">Le plateau</param>
 public override void execute(Board board)
 {
     if (ReferenceEquals(this.Tile, board.MementoManager.getLastTileClick()))
     {
         board.unSelectedAllTile();
         board.MementoManager.cancelChoice();
     }
     else
     {
         board.MementoManager.pushChoice(Tile.createMemento(), this.Tile);
         setSelectedPossibleTile(board, getPossibleMove(board));
     }
 }
Beispiel #3
0
 /// <summary>
 /// Changement de joueur
 /// </summary>
 public void choosePlayerTurn()
 {
     board.unSelectedAllTile();
     if (playerWhoPlay == null)
     {
         Random rand = new Random();
         playerWhoPlay = (rand.Next(2) == 1) ? p1 : p2;
     }
     else
     {
         playerWhoPlay = (playerWhoPlay.Equals(p1)) ? p2 : p1;
     }
     playerWhoPlay.myTurn(board);
 }
Beispiel #4
0
 /// <summary>
 /// Execute la Commande qui bouge la piece vers sa destination
 /// </summary>
 /// <param name="board">Le plateau</param>
 public override void execute(Board board)
 {
     board.MementoManager.pushAction(Tile.createMemento(), this.Tile, COMMAND_ACTION.BALL);
     board.unSelectedAllTile();
     this.executeAction(board);
 }