Assets/Scripts/BoardManager.cs
/// <summary>
/// Updates activeChessPiece in case it has at least one move 
/// </summary>
Updates activeChessPiece in case it has at least one move
Updates activeChessPiece in case it has at least one move
private void SelectPiece(int x, int z)
    {
        if (chessPieces[x, z] == null)
        {
            return;
        }
        if (chessPieces[x, z].isWhite != isWhiteTurn)
        {
            return;
        }
        bool hasAtLeastOneMove = false;
        allowedMoves = chessPieces[x, z].PossibleMove(this);
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++)
            {
                if (allowedMoves[i, j]) {
                    hasAtLeastOneMove = true;
                }
            }
        }
        if (!hasAtLeastOneMove)
        {
            return;
        }
        allowedMoves = chessPieces[x, z].PossibleMove(this);
        activeChessPiece = chessPieces[x, z];
        HighligthsManager.Instance.ownTileHighligth(x, z);
        HighligthsManager.Instance.AllowedMovesHighlight(allowedMoves);
    }
private void SelectPiece ( int x , int z ) { if ( chessPieces [ x , z ] == null ) { return ; } if ( chessPieces [ x , z ] . isWhite != isWhiteTurn ) { return ; } bool hasAtLeastOneMove = false ; allowedMoves = chessPieces [ x , z ] . PossibleMove ( this ) ; for ( int i = 0 ; i < 8 ; i ++ ) { for ( int j = 0 ; j < 8 ; j ++ ) { if ( allowedMoves [ i , j ] ) { hasAtLeastOneMove = true ; } } } if ( ! hasAtLeastOneMove ) { return ; } allowedMoves = chessPieces [ x , z ] . PossibleMove ( this ) ; activeChessPiece = chessPieces [ x , z ] ; HighligthsManager . Instance . ownTileHighligth ( x , z ) ; HighligthsManager . Instance . AllowedMovesHighlight ( allowedMoves ) ; }
Updates activeChessPiece in case it has at least one move
Updates activeChessPiece in case it has at least one move
//no corresponding piece  //check if the piece corresponds to the player... if not, exit
x
int
z
int