示例#1
0
 // Check if piece is selectable. Can select any piece belonging to the player.
 public bool CheckIfSelectable(GameData.IPiece clickedPiece, GameData.IPiece selectedPiece, int playerTurn)
 {
     if (selectedPiece == null && clickedPiece != null && clickedPiece.Player == playerTurn)
     {
         return(clickedPiece.Selectable);
     }
     return(false);
 }
示例#2
0
 // Move selected piece to another tile if a piece is selected.
 public void MoveSelectedPiece(int toColumn, int toRow, GameData.IPiece newPiece)
 {
     // Move piece to new tile.
     newPiece.Column = toColumn;
     newPiece.Row    = toRow;
     BoardGrid[toColumn, toRow].Piece = newPiece;
     // Remove the piece from the old tile.
     BoardGrid[SelectedPiece.Column, SelectedPiece.Row].Piece = null;
     // Remove piece from SelectedPiece.
     SelectedPiece = null;
 }