Game/Pieces/Piece.cs
/// <summary>
/// Function will trigger when updateBlockingPieces is true and given piece targeted an enemy
/// Will check if piece can attack king when targeting piece moves away
/// </summary>
/// <param name="board"></param>
/// <param name="blockingPiece"></param>
/// <param name="op"></param>
/// <param name="corner"></param>
/// <param name="rotation"></param>
Function will trigger when updateBlockingPieces is true and given piece targeted an enemy
Will check if piece can attack king when targeting piece moves away
Function will trigger when updateBlockingPieces is true and given piece targeted an enemy Will check if piece can attack king when targeting piece moves away
protected void HandleBlocking(Tile[] board, Piece blockingPiece, Func<int, int, int> op, int corner, int rotation)
        {
            while (true)
            {
                Coords coordinate = (Coords) op((int) Coords, rotation);
                if(!ValidCoordinate(board, coordinate, corner))
                    return;
                if (board.HasPawnOnTile(coordinate))
                {
                    if(board[(int) coordinate].Piece.EPiece == EPiece.King)
                        blockingPiece.Blocking.AddRange(GetAttackLine(board, op, rotation, corner));
                    return;
                }
                rotation++;
            }
        }
protected void HandleBlocking ( Tile [ ] board , Piece blockingPiece , Func < int , int , int > op , int corner , int rotation ) { while ( true ) { Coords coordinate = ( Coords ) op ( ( int ) Coords , rotation ) ; if ( ! ValidCoordinate ( board , coordinate , corner ) ) return ; if ( board . HasPawnOnTile ( coordinate ) ) { if ( board [ ( int ) coordinate ] . Piece . EPiece == EPiece . King ) blockingPiece . Blocking . AddRange ( GetAttackLine ( board , op , rotation , corner ) ) ; return ; } rotation ++ ; } }
Function will trigger when updateBlockingPieces is true and given piece targeted an enemy
Will check if piece can attack king when targeting piece moves away
Function will trigger when updateBlockingPieces is true and given piece targeted an enemy Will check if piece can attack king when targeting piece moves away
board
Tile[]
None
blockingPiece
Piece
None
op
Func<int, int, int>
None
corner
int
None
rotation
int
None