Game/GameManager.cs
/// <summary>
/// Moves pieces if possible, activates gameCycle
/// </summary>
/// <param name="fromCoords"></param>
/// <param name="newCoords"></param>
/// <returns>Returns true when piece was moved</returns>
Moves pieces if possible, activates gameCycle
Moves pieces if possible activates gameCycle
public void MovePiece(Coords fromCoords, Coords newCoords)
        {
            Piece piece = Board.Tiles[(int) fromCoords].Piece;
            if (piece.Side != Turn || !GetAvailableCoords(piece).Contains(newCoords))
                return;
            if (MoveCastling(fromCoords, newCoords))
                return;
            if (Board.Tiles.HasPawnOnTile(newCoords))
                TakeOverPiece(Board.Tiles[(int) newCoords].Piece);
            piece.Move(newCoords);
            Board.Tiles[(int) fromCoords].Piece = null;
            Board.Tiles[(int) newCoords].Piece = piece;
            UpdateGameCycle();
            OnPieceMoved(piece, fromCoords, newCoords);
        }
public void MovePiece ( Coords fromCoords , Coords newCoords ) { Piece piece = Board . Tiles [ ( int ) fromCoords ] . Piece ; if ( piece . Side != Turn || ! GetAvailableCoords ( piece ) . Contains ( newCoords ) ) return ; if ( MoveCastling ( fromCoords , newCoords ) ) return ; if ( Board . Tiles . HasPawnOnTile ( newCoords ) ) TakeOverPiece ( Board . Tiles [ ( int ) newCoords ] . Piece ) ; piece . Move ( newCoords ) ; Board . Tiles [ ( int ) fromCoords ] . Piece = null ; Board . Tiles [ ( int ) newCoords ] . Piece = piece ; UpdateGameCycle ( ) ; OnPieceMoved ( piece , fromCoords , newCoords ) ; }
Moves pieces if possible, activates gameCycle
Moves pieces if possible activates gameCycle
Returns true when piece was moved
Returns true when piece was moved
fromCoords
Coords
None
newCoords
Coords
None