Guest User

Untitled

a guest
Jun 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. private void SelectChessFigure(int x, int y)
  2. {
  3. if (ChessFigurePositions[x, y] == null) return;
  4. if (ChessFigurePositions[x, y].isWhite != isWhiteTurn) return;
  5.  
  6. bool hasAtLeastOneMove = false;
  7. allowedMoves = ChessFigurePositions[x, y].PossibleMove();
  8.  
  9. for(int i = 0; i < 8; i++)
  10. {
  11. for(int j = 0; j < 8; j++)
  12. {
  13. if(allowedMoves[i,j])
  14. {
  15. hasAtLeastOneMove = true;
  16. i = 7;
  17. break;
  18. }
  19. }
  20. }
  21.  
  22. if (!hasAtLeastOneMove) return;
  23.  
  24. selectedFigure = ChessFigurePositions[x, y];
  25. BoardHighlighting.Instance.HighlightAllowedMoves(allowedMoves);
  26. }
Add Comment
Please, Sign In to add comment