Ejemplo n.º 1
0
    // roll all unlocked dice
    public void rollDice()
    {
        print("rollDice()");
        currentRoll++;
        currentScore  = selectedScore + currentScore;
        selectedScore = 0;
        currentController.setRollScore();
        currentController.setCurrentScore();
        int countFree = 0;

        for (int i = 0; i < diceArray.Length; i++)
        {
            if (lockedArray [i] == 1)
            {
                lockedArray [i] = 2;
            }
            else if (lockedArray [i] == 0)
            {
                countFree++;
            }
        }
        rollScore = 0;
        //		turnScoreCurrent = turnScoreTemp;
        //		showScore();
        clearScoreArray();
        for (int i = 0; i < diceArray.Length; i++)
        {
            if (countFree == 0)
            {
                lockedArray [i] = 0;
            }
            if (lockedArray [i] == 0)
            {
                int rollInt = Random.Range(1, 7);
                diceArray [i] = rollInt;
            }
        }
        diceController.moveAllDice();
        diceController.showDice();
        if (checkNoScore())
        {
            noScore();
        }
        else
        {
            displayMessage("Click the scoring dice you want to lock. Click them again to unlock if you change your mind.");
        }
        hideRoll();
        hideBank();
    }