Beispiel #1
0
    private void Playing()
    {
        Debug.Log("currentPlayer " + currentPlayer);
        option1 = Co_the_xuat_chuong(currentPlayer, diceNumber);           // chi co the xuat chuong
        option2 = CheckAllHorseofPlayer(currentPlayer, diceNumber);        // chi di binh thuong
        option3 = CheckDiChuyenTrongChuongDich(currentPlayer, diceNumber); // di kieu gi cung duoc

        Debug.Log("kiem tra co the di hay k " + diceNumber.ToString());
        can_run = (option1 || option2 || option3);
        Debug.Log(option1.ToString() + option2.ToString() + option3.ToString());
        if (can_run == false)
        {
            // ChangeCamera((++currentPlayer - 1) % 4 + 1);

            if (diceNumber != 6)
            {
                currentPlayer = currentPlayer % 4 + 1;
            }

            DiceThrowThread = null;
        }
        if (CheckBot[currentPlayer])
        {
            for (int i = 1; i <= 4; i++)
            {
                if (player[currentPlayer].getHorse(i).GetCanRun() > 0)
                {
                    horsePicking = player[currentPlayer].getHorse(i);
                    break;
                }
            }
        }

        // Debug.Log("player can run " + currentPlayer.ToString());

        if (horsePicking != null && horsePicking.getplayerNumber() == currentPlayer && horsePicking.GetCanRun() > 0)
        {
            Debug.Log(currentPlayer.ToString() + "Co the di chuyen");
            Run_horse(currentPlayer);
            ResetAfterOneTurn(currentPlayer);
            if (diceNumber != 6)
            {
                currentPlayer = currentPlayer % 4 + 1;
            }
            else
            {
                horsePicking = null;
            }
            DiceThrowThread = null;
        }
    }