Guest User

Untitled

a guest
Jun 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. private void MoveChessFigure(int x, int y)
  2. {
  3. if(allowedMoves[x,y])
  4. {
  5. ChessFigure c = ChessFigurePositions[x, y];
  6. if(c != null && c.isWhite != isWhiteTurn)
  7. {
  8. activeFigures.Remove(c.gameObject);
  9. Destroy(c.gameObject);
  10.  
  11. if(c.GetType() == typeof(King))
  12. {
  13. EndGame();
  14. return;
  15. }
  16. }
  17.  
  18. ChessFigurePositions[selectedFigure.CurrentX, selectedFigure.CurrentY] = null;
  19. selectedFigure.transform.position = GetTileCenter(x, y);
  20. selectedFigure.SetPosition(x, y);
  21. ChessFigurePositions[x, y] = selectedFigure;
  22. isWhiteTurn = !isWhiteTurn;
  23. }
  24.  
  25. BoardHighlighting.Instance.HideHighlights();
  26. selectedFigure = null;
  27. }
Add Comment
Please, Sign In to add comment