// Deal public void Deal() { _sideGameState = ESideGameState.NONE; _gameUIManager.StartGame(); _gameUIManager.SetTotalBattingChipText(_player.GetBattingFee()); _gameUIManager.SetBalanceText(_player.GetBalance()); _player.ClearHand(); _dealer.ClearHand(); for (int i = 0; i < 2; ++i) { _player.PushCard(_deck.Pop()); _player.ShowCardFace(i, true); _dealer.PushCard(_deck.Pop()); } _dealer.ShowCardFace(0, true); //if the dealer's hand is not blackjack, it does not reveal. _dealer.ShowCardFace(1, (_dealer.GetTotalHandCardValue() == 21)); //check player is black jack or not if (_player.GetTotalHandCardValue() == 21) { _player.IsBlackJack = true; } _gameUIManager.SetPlayerHandCardValue(_player.GetFaceUpCardValue()); _gameUIManager.SetDealerHandCardValue(_dealer.GetFaceUpCardValue()); }
//if the two cards have the same value, separate them to make two hands public void DoubleDown() { _sideGameState = ESideGameState.DOUBLE; if (CanBatting(_player.GetBattingFee())) { Hit(true); UserStand(); } }
//give up a half-bet and retire from the game public void Surrender() { _sideGameState = ESideGameState.SURRENDER; UserStand(); }