Ejemplo n.º 1
0
    public int calculateDice(int dic3, int dic6)
    {
        resD3Array = new int[dic3];
        int _RollD3resSUM = 0;

        resD6Array = new int[dic6];
        int _RollD6resSUM = 0;

        for (int i = 0; i < dic3; i++)
        {
            Dice tem = new Dice3();
            tem.Roll();
            resD3Array[i] = tem.getDiceRes();
            //            Debug.Log(tem.getDiceRes());
            _RollD3resSUM += tem.getDiceRes();
        }
        //		Debug.Log(dic3 + " 颗三面骰子的和 " + _RollD3resSUM);

        for (int i = 0; i < dic6; i++)
        {
            Dice tem = new Dice6();
            tem.Roll();
            resD6Array[i] = tem.getDiceRes();
            //            Debug.Log(tem.getDiceRes());
            _RollD6resSUM += tem.getDiceRes();
        }
        //		Debug.Log(dic6+ " 颗六面骰子的和 " + _RollD6resSUM);
        int _sum = _RollD3resSUM + _RollD6resSUM;

        //  Debug.Log(dic3 + " 颗三面骰子和 " + dic6 + " 颗六面骰子的结果为 " + _sum);
        return(_RollD3resSUM + _RollD6resSUM);
    }
Ejemplo n.º 2
0
    public int calculateDice(int totalDiceNum, int dic3, int dic6)
    {
        if ((dic3 + dic6) > totalDiceNum)
        {
            return(0);
        }


        int[] resD3Array    = new int[dice3Amount];
        int   _RollD3resSUM = 0;

        int[] resD6Array    = new int[dice6Amount];
        int   _RollD6resSUM = 0;

        for (int i = 0; i < dice3Amount; i++)
        {
            Dice tem = new Dice3();
            tem.Roll();
            resD3Array[i] = tem.getDiceRes();
            Debug.Log(tem.getDiceRes());
            _RollD3resSUM += tem.getDiceRes();
        }
        Debug.Log(dice3Amount + " 颗三面骰子的和 " + _RollD3resSUM);

        for (int i = 0; i < dice6Amount; i++)
        {
            Dice tem = new Dice6();
            tem.Roll();
            resD6Array[i] = tem.getDiceRes();
            Debug.Log(tem.getDiceRes());
            _RollD6resSUM += tem.getDiceRes();
        }
        Debug.Log(dice6Amount + " 颗六面骰子的和 " + _RollD6resSUM);
        return(_RollD3resSUM + _RollD6resSUM);
    }