Exemplo n.º 1
0
 private void StartDrawPhase()
 {
     pot.DisplayRaiseAmount(totalRaiseAmount);
     if (++drawPhaseCount >= pokerRules.MaxDrawsAllowed)
     {
         // no more draws. Call game.
         ShowDown();
     }
     else
     {
         phase = PokerRules.TurnPhase.Draw;
         currentPlayerIndex     = 0;
         firstPlayerToDrawCards = null;
         StartPlayerTurn();
     }
 }
Exemplo n.º 2
0
        public void Fold(PokerPlayer currentPlayer)
        {
            EndPlayerTurn();
            currentPlayer.Fold();
            activePlayers.Remove(currentPlayer);
            if (activePlayers.Count == 1)
            {
                ShowDown();
                return;
            }

            if (--currentPlayerIndex < 0)
            {
                currentPlayerIndex = 0;
            }
            StartCoroutine(PrepNextPlayerTurn());
        }
Exemplo n.º 3
0
        private void StartPlayerTurn()
        {
            playerNameText.text = activePlayers[currentPlayerIndex].name;

            switch (phase)
            {
            case PokerRules.TurnPhase.Draw:
                if (firstPlayerToDrawCards == null)
                {
                    firstPlayerToDrawCards = activePlayers[currentPlayerIndex];
                }
                else if (firstPlayerToDrawCards == activePlayers[currentPlayerIndex])
                {
                    EndPlayerTurn();
                    StartBetPhase();
                    break;
                }

                drawButton.SetActive(true);
                activePlayers[currentPlayerIndex].StartDraw();

                break;

            case PokerRules.TurnPhase.Bet:
                if (lastRaiser == null)
                {                         // this is the first bet
                    lastRaiser = activePlayers[currentPlayerIndex];
                }
                else if (lastRaiser == activePlayers[currentPlayerIndex])
                {                         // betting phase is done
                    EndPlayerTurn();
                    StartDrawPhase();
                    break;
                }

                int amtMatched = amountMatchedThisRound[activePlayers[currentPlayerIndex]];
                activePlayers[currentPlayerIndex].StartBetting(betting, totalRaiseAmount - amtMatched);

                break;
            }
        }
Exemplo n.º 4
0
 public void SetOwner(PokerPlayer player)
 {
     owner = player;
 }
Exemplo n.º 5
0
 public HandRank(PokerPlayer player, List <Card> hand)
 {
     this.hand = hand;
     hand.Sort();
     GetBestHand();
 }
Exemplo n.º 6
0
 private void Winner(PokerPlayer player)
 {
     player.AddFunds(pot.GetWinnings());
 }