Exemplo n.º 1
0
    // Trade constructor takes two list of ints corresponding to the Muffin enum values, one for the buying group and one for the selling group
    public Trade(List <int> in_selling, List <int> in_buying)
    {
        // Convert selling group ints to Muffin enums and increment their number in the Selling dictionary
        foreach (int i in in_selling)
        {
            DarkMagician.Muffin key = (DarkMagician.Muffin)i;
            if (Selling.ContainsKey(key))
            {
                Selling[key] = Selling[key] + 1;
            }
            else
            {
                Selling.Add(key, 1);
            }
        }

        // Convert buying group ints to Muffin enums and increment their number in the Buying dictionary
        foreach (int i in in_buying)
        {
            DarkMagician.Muffin key = (DarkMagician.Muffin)i;
            if (Buying.ContainsKey(key))
            {
                Buying[key] = Buying[key] + 1;
            }
            else
            {
                Buying.Add(key, 1);
            }
        }
    }
Exemplo n.º 2
0
    // Returns the corresponding muffin sprite to display
    protected Sprite GetSpriteForItem(DarkMagician.Muffin in_muffin)
    {
        switch (in_muffin)
        {
        case DarkMagician.Muffin.GOLD:
            return(muffinSprites[0]);

        case DarkMagician.Muffin.CHOCOLATE:
            return(muffinSprites[1]);

        case DarkMagician.Muffin.BLUEBERRY:
            return(muffinSprites[2]);

        case DarkMagician.Muffin.STRAWBERRY:
            return(muffinSprites[3]);

        case DarkMagician.Muffin.CHIP:
            return(muffinSprites[4]);

        case DarkMagician.Muffin.BRAN:
            return(muffinSprites[5]);

        default:
            return(null);       // unreachable code
        }
    }