Пример #1
0
    IEnumerator DrawCard()
    {
        AudioSourceCard.Play();
        CardHolder parent = tableaus[CurrentPlayerIdx];

        LastDrawnCard = PopCard(parent.name != "Bottom");
        yield return(CurrentPlayer.AddCard(LastDrawnCard, false));

        OnDrawCard();
        NumActions++;
    }
Пример #2
0
    IEnumerator PlayCardCR(Card card)
    {
        Interactable = false;
        AudioSourceCard.Play();

        LastCardPlayed = card;
        card.FaceDown  = false;
        CurrentPlayer.RemoveCard(card);

        switch (card.Rank)
        {
        case Rank.Ace:
            if (IsOffensive(WasteCard))
            {
                AudioPlayShield();
            }
            AccumulatedCards = 0;
            break;

        case Rank.Two:
            AudioPlaySword();
            AccumulatedCards += 2;
            if (CurrentPlayerHasPotion(PotionType.BasicSword))
            {
                yield return(AnimatePotion(PotionType.BasicSword));

                AccumulatedCards += 1;
            }
            break;

        case Rank.Joker:
            AudioPlaySword();
            AccumulatedCards += 5;
            if (CurrentPlayerHasPotion(PotionType.BasicSword))
            {
                yield return(AnimatePotion(PotionType.BasicSword));

                AccumulatedCards += 1;
            }
            break;

        case Rank.Seven:
            SkipCounter = SkipCounter == 1 ? 0 : 1;
            break;

        case Rank.Eight:
            AudioPlayTotem();
            break;

        case Rank.Jack:
            SwitchDirection();
            break;

        case Rank.Queen:
            AudioPlayQueen();
            break;
        }

        if (card.Rank == Rank.Eight && WasteCard.Rank == Rank.Eight)
        {
            Crazy8 = card.Suit;
        }
        uiPlaySpecialBar.ShowBasedOnCard(card, Crazy8);

        if (card.Rank == Rank.Queen && WasteCard.Rank == Rank.Queen)
        {
            AccumulatedCards = 0;
            yield return(SpawnZombieCR());
        }

        if (IsOffensive(card) && WasteCard.Rank == Rank.Kraken)
        {
            /*
             * SpawnParticleSystem(wasteCard.transform, destroyKrakinPrefab);
             */
            if (WasteCard && WasteCard.gameObject)
            {
                DestroyImmediate(WasteCard.gameObject);
            }
        }

        if (IsDefensive(card) && WasteCard.Rank == Rank.Alruana)
        {
            /*
             * SpawnParticleSystem(wasteCard.transform, destroyKrakinPrefab);
             */
            if (WasteCard && WasteCard.gameObject)
            {
                DestroyImmediate(WasteCard.gameObject);
            }
        }

        yield return(EnqueueWasteCardCR(card));

        switch (card.Rank)
        {
        case Rank.Queen:
            if (AccumulatedCards > 0)
            {
                Time.timeScale = 0.8f;
                if (CurrentPlayerHasPotion(PotionType.TemptressShield))
                {
                    yield return(AnimatePotion(PotionType.TemptressShield));

                    AccumulatedCards -= Math.Min(2, AccumulatedCards);
                }
                else
                {
                    yield return(DrawAccumulatedCards(2));
                }

                if (AccumulatedCards > 0)
                {
                    SwitchDirection();

                    /*
                     * reverseDirectionCounter = 0;
                     * reverseDirectionKeepGoing = true;
                     */
                }
                Time.timeScale = 1.0f;
            }
            break;
        }

        /*
         * if (pvp)
         * {
         *  SendRealtimePokerHandMsg(new PokerHandMessage((int)PVP_CMDS.PLAY_CARD, currentPlayerIdx, card.dcIndex.ToString()));
         * }
         */

        if (!CurrentPlayerHasCards)
        {
            // TODO: RoundOver();
        }

        if (!IsSpellCard(card))
        {
            NumActions++;
        }

        Interactable = true;
    }