Exemple #1
0
    //I now notice that passing the origin or piece.position is completly un needed
    //I'll leave it be for now but it may get moved out on the server split.
    List<Vector2> ClickedPieceMoves(Piece clickedPiece)
    {
        List<Vector2> possibleMoves = new List<Vector2>();

        switch (clickedPiece.type)
        {
            case Piece.Type.PAWN:

                possibleMoves = clickedPiece.PawnMoves(clickedPiece.position, clickedPiece.player, tiles,
                    pieces);
                break;

            case Piece.Type.BISHOP:
                possibleMoves = clickedPiece.BishopMoves(clickedPiece.position, clickedPiece.player,
                    tiles, pieces);
                break;

            case Piece.Type.KNIGHT:
                possibleMoves = clickedPiece.KnightMoves(clickedPiece.position, clickedPiece.player,
                    tiles, pieces);
                break;

            case Piece.Type.ROOK:
                possibleMoves = clickedPiece.RookMoves(clickedPiece.position, clickedPiece.player,
                    tiles, pieces);
                break;

            case Piece.Type.QUEEN:
                possibleMoves = clickedPiece.QueenMoves(clickedPiece.position, clickedPiece.player,
                    tiles, pieces);
                break;

            case Piece.Type.KING:
                KingStuff(clickedPiece);

                possibleMoves = clickedPiece.KingMoves(clickedPiece.position, clickedPiece.player,
                    tiles, pieces);
                break;

            default:
                Debug.Log("Something wrong in piece type");
                break;
        }

        return possibleMoves;
    }