Пример #1
0
    void Update()
    {
        if (lives == 0 && gameIsStarted)
        {
            LoseGame();
        }

        if (CountOfDealedCards == 0 && gameIsStarted)
        {
            CountOfDealedCards = GameRules.CardForDealing;

            cardDealer.DealCards();
        }

        if (cardDealer.cardFirst != null && cardDealer.cardSecond != null)
        {
            if (cardDealer.cardFirst.CardId == cardDealer.cardSecond.CardId)
            {
                bonusAnswers++;
                if (bonusAnswers == 1)
                {
                    AddBonuseLive();
                }

                scoreDirector.AddScore(1);

                cardDealer.PutChoosenCardsBackToDeck();

                CountOfDealedCards -= 2;
            }
            else
            {
                bonusAnswers = 0;                 // сброс бонусной серии

                lives--;
                DeleteStar();

                cardDealer.HideChoosenCards();
            }
        }
    }