コード例 #1
0
ファイル: Inventory.cs プロジェクト: raimis001/raWorld
    void AddCollection(ItemClass item, int amount, int foodType)
    {
        FoodClass food = null;

        switch (foodType)
        {
        case 0:                 //Raw food
            food = ((ItemFood)item).Raw;
            break;

        case 1:                 //boiled food
            food = ((ItemFood)item).Boil;
            break;

        case 2:                 //Raw food
            food = ((ItemFood)item).Bake;
            break;
        }
        if (food == null)
        {
            return;
        }

        Food.Add(food, amount);

        if (FoodParams)
        {
            FoodParams.Food = Food;
        }
        if (TasteParam)
        {
            TasteParam.Progress = Food.Taste;
        }
    }
コード例 #2
0
        public void CompositeImplementation()
        {
            var shop       = new FoodCollection("KFC");
            var childCombo = new FoodCollection("Children Combo Box");

            childCombo.Add(new SimpleFood("Nugget"));
            childCombo.Add(new SimpleFood("Chicken"));

            var adultCombo = new FoodCollection("Adult Combo Box");

            adultCombo.Add(new SimpleFood("Burger"));
            adultCombo.Add(new SimpleFood("Chicken"));

            shop.Add(childCombo);
            shop.Add(adultCombo);

            var info = shop.ShowInfo();

            Assert.That(info.Length > 0);
        }