Пример #1
0
    public IEnumerator StartOfGame()
    {
        foreach (BaseDeckEntry e in startingDeck)
        {
            for (int i = 0; i < e.copies; ++i)
            {
                e.card.Clone().MoveTo(deck);
            }
        }

        foreach (Card c in basicCards)
        {
            Store.StoreEntry storeEntry = new Store.StoreEntry();
            coinsShop.AddPile(c.name, c.buyCost);
            for (int j = 0; j < BASIC_CARDS_COUNT; ++j)
            {
                coinsShop.AddElement(c.Clone());
            }
        }

        BuyableSet uniqueCards = cards.Clone();

        //Don't add cards that we already have
        uniqueCards.Modify((Buyable b) => coinsShop.HasPile(b.name), 0.0f);

        for (int i = 0; i < 4; ++i)
        {
            Card c = (Card)uniqueCards.RandomlyChooseElement();
            if (c != null)
            {
                Store.StoreEntry storeEntry = new Store.StoreEntry();
                coinsShop.AddPile(c.name, c.buyCost);
                for (int j = 0; j < INIT_STORE_CARDS_COUNT; ++j)
                {
                    coinsShop.AddElement(c.Clone());
                }
            }
        }

        BuyableSet uniqueBlueprints = blueprints.Clone();

        uniqueBlueprints.Modify((Buyable b) => hammersShop.HasPile(b.name), 0.0f);
        for (int i = 0; i < 4; ++i)
        {
            Blueprint b = (Blueprint)uniqueBlueprints.RandomlyChooseElement();
            if (b != null)
            {
                Store.StoreEntry storeEntry = new Store.StoreEntry();
                hammersShop.AddPile(b.name, b.buyCost);
                hammersShop.AddElement(b.Clone());
            }
        }

        //TODO: Research

        health = 100;
        yield return(InputManager.instance.PlayEffect(new StartOfTurn()));
    }
Пример #2
0
    public static BuyableSet operator+(BuyableSet a, BuyableSet b)
    {
        BuyableSet result = ScriptableObject.CreateInstance("BuyableSet") as BuyableSet;

        result.elements = new Buyable[a.elements.Length + b.elements.Length];
        a.elements.CopyTo(result.elements, 0);
        b.elements.CopyTo(result.elements, a.elements.Length);
        result.modifiers = new HashSet <Modifier>(a.modifiers.Concat(b.modifiers).ToList());
        return(result);
    }
Пример #3
0
    public BuyableSet Clone()
    {
        BuyableSet other = ScriptableObject.CreateInstance("BuyableSet") as BuyableSet;

        other.elements = new Buyable[elements.Length];
        for (int i = 0; i < elements.Length; ++i)
        {
            //TODO: Maybe can't do this
            other.elements[i] = elements[i];
        }
        other.modifiers = new HashSet <Modifier>(modifiers);

        return(other);
    }