Esempio n. 1
0
    public void PlayMove(Move move)
    {
        GameUi.Instance.OnMovePlayed(move);
        Board.ExecuteMove(move);

        move.piece.transform.position = new Vector3(
            move.targetPosition.x,
            move.piece.transform.position.y,
            move.targetPosition.y);

        if (currentTurn == Color.White)
        {
            currentTurn = Color.Black;
        }
        else
        {
            currentTurn = Color.White;
        }

        var winner = Board.GetWinner();

        if (winner.HasValue)
        {
            GameUi.Instance.OnWon(winner.Value);
        }
        else if (currentTurn == Color.Black)
        {
            PlayMove(ChessAI.GetNextMove(Board, Color.Black));
        }
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("GetNextMove"))
        {
            Debug.Log(ChessAI.GetNextMove(GameManager.Instance.Board, Color.Black));
        }

        // Show default inspector property editor
        DrawDefaultInspector();
    }