Esempio n. 1
0
    private static Card GetCloneOfCardFromAvailablePrototypesRandomly()
    {
        Card[] allPrototypes = CardPrototypesAccessor.allCardPrototypes;
        Card[] unlockedCards = CardsCollection.GetUnlockedCardsFrom(allPrototypes);
        int    randomIndex   = Random.Range(0, unlockedCards.Length);

        return(unlockedCards[randomIndex].GetClone());
    }
    public static OneOfEachUnlockedCardInClassDeckBuilder Create(Classes classe)
    {
        Card[] allCardsOfClass    = ClassInfo.GetCardsOfClass(classe);
        Card[] unlockedPrototypes = CardsCollection.GetUnlockedCardsFrom(allCardsOfClass);
        OneOfEachUnlockedCardInClassDeckBuilder builder = new OneOfEachUnlockedCardInClassDeckBuilder(unlockedPrototypes.Length);

        builder.unlockedCardPrototypes = unlockedPrototypes;
        return(builder);
    }
Esempio n. 3
0
    // TODO: Make DeckBuilder for this
    public static Card[] Get2DifferentRandomUnlockedNotMonsterCards(int deckSize)
    {
        Card[] notMonstersUnlocked = CardsCollection.GetUnlockedCardsFrom(CardPrototypesAccessor.notMonsterPrototypes);
        Card[] cards = new Card[2];

        cards[0] = notMonstersUnlocked[Random.Range(0, notMonstersUnlocked.Length)].GetClone();

        do
        {
            cards[1] = notMonstersUnlocked[Random.Range(0, notMonstersUnlocked.Length)].GetClone();
        } while (cards[0].IsAnotherInstanceOf(cards[1]));

        return(cards);
    }
Esempio n. 4
0
    private static Card[] ReplaceMonsters(Card[] playerDeck)
    {
        Card[] notMonstersUnlocked = CardsCollection.GetUnlockedCardsFrom(CardPrototypesAccessor.notMonsterPrototypes);
        for (int i = 0; i < playerDeck.Length; i++)
        {
            if (playerDeck[i].Classe == Classes.MONSTER)
            {
                Object.Destroy(playerDeck[i].gameObject);

                int randomIndex = UnityEngine.Random.Range(0, notMonstersUnlocked.Length);
                playerDeck[i] = notMonstersUnlocked[randomIndex].GetClone();
            }
        }

        return(playerDeck);
    }