Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void MoveChessFigure(int x, int y)
- {
- if(allowedMoves[x,y])
- {
- ChessFigure c = ChessFigurePositions[x, y];
- if(c != null && c.isWhite != isWhiteTurn)
- {
- activeFigures.Remove(c.gameObject);
- Destroy(c.gameObject);
- if(c.GetType() == typeof(King))
- {
- EndGame();
- return;
- }
- }
- ChessFigurePositions[selectedFigure.CurrentX, selectedFigure.CurrentY] = null;
- selectedFigure.transform.position = GetTileCenter(x, y);
- selectedFigure.SetPosition(x, y);
- ChessFigurePositions[x, y] = selectedFigure;
- isWhiteTurn = !isWhiteTurn;
- }
- BoardHighlighting.Instance.HideHighlights();
- selectedFigure = null;
- }
Add Comment
Please, Sign In to add comment