예제 #1
0
    /// <summary>
    /// It's called when the movement chose by this player is finished.
    /// </summary>
    public override void NotifyEndOfMovement()
    {
        // See if the piece can capture again.
        if (base.isCapturing)
        {
            canMoveTo = base.currentPiece.GetBestSucessiveCapture();
            if (canMoveTo.Count != 0)
            {
                isSucessiveCapture = true;
                base.board.DeselectTiles();
                base.board.SelectPiece(base.currentPiece, canMoveTo);
                return;
            }
        }

        // Try to promote
        if (base.currentPiece.GetComponent <ManPiece>() != null)
        {
            ManPiece currentManPiece = base.currentPiece.GetComponent <ManPiece>();
            if (currentManPiece != null)
            {
                currentManPiece.Promote();
            }
        }
        // Reset state and call the next turn.
        isSucessiveCapture = false;
        canMoveTo          = null;
        base.isCapturing   = false;
        base.currentPiece  = null;
        base.board.DeselectTiles();
        base.board.DestroyCapturedPieces();
    }
예제 #2
0
파일: Bot.cs 프로젝트: ommzi-dev/5-Games
    /// <summary>
    /// It's called when the movement chose by this player is finished.
    /// </summary>
    public override void NotifyEndOfMovement()
    {
        // Find out if the current piece can capture again.
        if (base.isCapturing)
        {
            ArrayList canMoveTo = base.currentPiece.GetBestSucessiveCapture();
            isSucessiveCapture = true;
            if (canMoveTo.Count != 0)
            {
                this.Play();
                return;
            }
        }

        // Try to promote
        ManPiece currentManPiece = base.currentPiece.GetComponent <ManPiece>();

        if (currentManPiece != null)
        {
            currentManPiece.Promote();
        }

        // Finish this turn.
        isSucessiveCapture = false;
        base.isCapturing   = false;
        base.currentPiece  = null;
        base.board.DestroyCapturedPieces();
    }