Ejemplo n.º 1
0
    void ShuffleDeck(Deck deck)
    {
        CardContainer[] tempDeck = new CardContainer[deck.deckContainer.getSize()];
        for (int i = 0; i < deck.deckContainer.getSize(); i++)
        {
            tempDeck[i] = deck.deckContainer.deck[i];
        }

        heroField.SetCardDB(deck.hero.card);
        heroField.FaceUpCard();
        for (int t = 0; t < tempDeck.Length; t++)
        {
            CardContainer tmp = tempDeck[t];
            int           r   = Random.Range(t, tempDeck.Length);
            tempDeck[t] = tempDeck[r];
            tempDeck[r] = tmp;
        }
        Debug.Log(tempDeck[0]);
        deckField.deck = tempDeck;
    }