public void SelectPiece(GamePoint p) { ChessPiece piece; if (Board.TryPickup(p, out piece)) { Selected = piece; } }
public void DeselectPiece(GamePoint p) { if (Selected != null) { ChessPiece other; if (!Board.TryPickup(p, out other)) { Board.Move(Selected, p); } } Selected = null; }
public void Move(ChessPiece piece, GamePoint p) { Grid[p.X, p.Y] = Grid[piece.Location.X, piece.Location.Y]; Grid[piece.Location.X, piece.Location.Y] = null; piece.Location = p; }
public bool TryPickup(GamePoint p, out ChessPiece piece) { piece = Grid[p.X, p.Y]; return piece != null; }