Assets/Scripts/BoardManager.cs
/// <summary>
/// Update() is called one per frame
/// Proceeds to check if castling could be allowed in that move through updating some vars
/// Note:
/// dont know if the requestDecision() is needed when the AI is playing: i think it will be called either way
/// </summary>
Update() is called one per frame
Proceeds to check if castling could be allowed in that move through updating some vars
Note:
dont know if the requestDecision() is needed when the AI is playing: i think it will be called either way
Update () is called one per frame Proceeds to check if castling could be allowed in that move through updating some vars Note : dont know if the requestDecision () is needed when the AI is playing : i think it will be called either way
void Update()
    {
        checkIfRooksOrKingMoves();
        Instance = this;
        if (isWhiteTurn)
        {
            if (whitePlayer == null)
            {
                UpdateSelection();
                if (Input.GetMouseButtonDown(0))
                {
                    if (CurrentTileX >= 0 && CurrentTileZ >= 0)
                    {
                        if (activeChessPiece == null)
                        {
                            SelectPiece(CurrentTileX, CurrentTileZ);
                        }
                        else
                        {
                            MovePiece(activeChessPiece.CurrentX, activeChessPiece.CurrentZ, CurrentTileX, CurrentTileZ);
                        }
                    }
                }
            }
            else
            {
                whitePlayer.RequestDecision();
            }
        }
        else
        {
            if (blackPlayer == null)
            {
                UpdateSelection();
                if (Input.GetMouseButtonDown(0))
                {
                    if (CurrentTileX >= 0 && CurrentTileZ >= 0)
                    {
                        if (activeChessPiece == null)
                        {
                            SelectPiece(CurrentTileX, CurrentTileZ);
                        }
                        else
                        {
                            MovePiece(activeChessPiece.CurrentX, activeChessPiece.CurrentZ, CurrentTileX, CurrentTileZ);
                        }
                    }
                }
            }
            else
            {
                blackPlayer.RequestDecision();
            }
        }
    }
void Update ( ) { checkIfRooksOrKingMoves ( ) ; Instance = this ; if ( isWhiteTurn ) { if ( whitePlayer == null ) { UpdateSelection ( ) ; if ( Input . GetMouseButtonDown ( 0 ) ) { if ( CurrentTileX >= 0 && CurrentTileZ >= 0 ) { if ( activeChessPiece == null ) { SelectPiece ( CurrentTileX , CurrentTileZ ) ; } else { MovePiece ( activeChessPiece . CurrentX , activeChessPiece . CurrentZ , CurrentTileX , CurrentTileZ ) ; } } } } else { whitePlayer . RequestDecision ( ) ; } } else { if ( blackPlayer == null ) { UpdateSelection ( ) ; if ( Input . GetMouseButtonDown ( 0 ) ) { if ( CurrentTileX >= 0 && CurrentTileZ >= 0 ) { if ( activeChessPiece == null ) { SelectPiece ( CurrentTileX , CurrentTileZ ) ; } else { MovePiece ( activeChessPiece . CurrentX , activeChessPiece . CurrentZ , CurrentTileX , CurrentTileZ ) ; } } } } else { blackPlayer . RequestDecision ( ) ; } } }
Update() is called one per frame
Proceeds to check if castling could be allowed in that move through updating some vars
Note:
dont know if the requestDecision() is needed when the AI is playing: i think it will be called either way
Update () is called one per frame Proceeds to check if castling could be allowed in that move through updating some vars Note : dont know if the requestDecision () is needed when the AI is playing : i think it will be called either way
//White PLaying //Human Player here //select the piece //move the piece //AI playing //Black PLaying //Human Player here //select the piece //move the piece //AI playing //Debug.Log("Black player should play -.-");