示例#1
0
        public void RollDice()
        {
            BoardFloor.ResetCubes();
            ButtonStatus(false);
            if (playerIndex + DEF_DICE_EACH_TURN > DICE_ARRAY_SIZE)
            {
                diceForTurn = DICE_ARRAY_SIZE - playerIndex;
            }
            else
            {
                diceForTurn = DEF_DICE_EACH_TURN;
            }
            currentCubes = new GameObject[diceForTurn];
            int i;
            int ccIndex = 0;

            for (i = playerIndex; i < playerIndex + diceForTurn; i++)
            {
                currentCubes [ccIndex] = DiceBoard.PlayerCubes [i];
                currentCubes [ccIndex].GetComponent <Dice> ().highlighter.ConstantOffImmediate();
                ForceThrow(DiceBoard.PlayerCubes [i]);
                ccIndex++;
            }
            playerIndex     = i;
            playerBank.text = (DICE_ARRAY_SIZE - playerIndex).ToString();
            StartCoroutine(CheckCubes());

            StartCoroutine(PlayDiceRollDelay());
        }
示例#2
0
 private void EndTurn()
 {
     DeHighLightAllCubes();
     BoardFloor.ResetCubes();
     DeleteCurrDice();
     if (isPlayerTurn)
     {
         if (playerIndex == DICE_ARRAY_SIZE)
         {
             isPlayerDone = true;
         }
         if ((isPlayerDone && isRivalDone) || (HPVAL <= 0) || (rivalHPVAL <= 0))
         {
             CheckWin();
         }
         else
         {
             if (!isRivalDone)
             {
                 AITurn();
             }
             else
             {
                 isPlayerTurn = true;
                 ButtonStatus(true);
                 HighLightCurrentPlayerCubes();
             }
         }
     }
     else
     {
         if (rivalIndex == DICE_ARRAY_SIZE)
         {
             isRivalDone = true;
         }
         if ((isPlayerDone && isRivalDone) || (HPVAL <= 0) || (rivalHPVAL <= 0))
         {
             CheckWin();
         }
         else
         {
             if (isPlayerDone)
             {
                 AITurn();
             }
             else
             {
                 isPlayerTurn = true;
                 ButtonStatus(true);
                 HighLightCurrentPlayerCubes();
             }
         }
     }
 }