public void SelectCursorPosition(PieceColor currentPlayer) { if (PieceSelection.moveOptions.Contains(_cursor.getCoordinates())) { var start = PieceSelection.piece.Coordinates; var end = _cursor.getCoordinates(); var piece = PieceSelection.piece; _moveSelectedPiece(_cursor.getCoordinates()); var memento = new BoardMemento(piece, start, end); var payload = new EndTurnEventArgs(memento); OnEndTurn(payload); } else { _selectCursorPiece(currentPlayer); } }
public void OnEndTurn(object source, EndTurnEventArgs e) { _history.Push(e.Memento); _currentPlayer = _currentPlayer.GetOpposingColor(); }