Esempio n. 1
0
    IEnumerator checkObjectsHaveStopped()
    {
        DiceRollerBase.showDiceArea(1, true);

        Rigidbody[] dice        = FindObjectsOfType(typeof(Rigidbody)) as Rigidbody[];
        bool        allSleeping = false;

        while (!allSleeping)
        {
            allSleeping = true;

            foreach (Rigidbody dye in dice)
            {
                if (!dye.IsSleeping())
                {
                    allSleeping = false;
                    yield return(null);

                    break;
                }
            }
        }

        DiceRollerBase.getDiceResults(dice);
    }
Esempio n. 2
0
    public IEnumerator RollAttackDice(System.Action <Player> callBack)
    {
        // TODO change the first param to be dynamic!
        DiceRollerBase.showDiceArea(1, true);
        Rigidbody[] GOS         = FindObjectsOfType(typeof(Rigidbody)) as Rigidbody[];
        bool        allSleeping = false;

        while (!allSleeping)
        {
            allSleeping = true;

            foreach (Rigidbody GO in GOS)
            {
                if (!GO.IsSleeping())
                {
                    allSleeping = false;
                    yield return(null);

                    break;
                }
            }
        }

        DiceRollerBase.getDiceResults(GOS);

        Player result = null;

        if (LocalDataWrapper.getPlayer().getLastDiceResults()[0] == DiceRollerBase.DICE_RESULT_HIT_OR_EVADE || LocalDataWrapper.getPlayer().getLastDiceResults()[0] == DiceRollerBase.DICE_RESULT_CRIT)
        {
            result = MatchDatas.getPlayers()[0];
        }
        else
        {
            result = MatchDatas.getPlayers()[1];
        }

        callBack(result);
    }