示例#1
0
        public Ingredient(string name, IngredientType ingredientType, float protein, float fats, float carbs, float vitamins, float minerals)
        {
            this.ingredientType = ingredientType;
            this.name           = name;
            organicParts        = new OrganicParts(protein, fats, carbs, vitamins, minerals);

            // ingredientType.ingredients.Add(this);
        }
示例#2
0
        public WeightedIngredient(Ingredient ingredient, float weight)
        {
            this.weight     = weight;
            this.ingredient = ingredient;

            weightedOrgParts = ingredient.organicParts * weight;

            // ingredient.wIngredients.Add(this);
        }
示例#3
0
        public OrganicParts sumRecipes()
        {
            OrganicParts orgParts = new OrganicParts(0, 0, 0, 0, 0);

            foreach (Recipe rec in recipes)
            {
                orgParts += rec.SumIngredients();
            }

            return(orgParts);
        }
示例#4
0
        public OrganicParts SumIngredients()
        {
            OrganicParts orgParts = new OrganicParts(0, 0, 0, 0, 0);

            foreach (WeightedIngredient weighIng in wIngredients)
            {
                orgParts += weighIng.weightedOrgParts;
            }

            return(orgParts);
        }
示例#5
0
        public static OrganicParts operator +(OrganicParts orgParts1, OrganicParts orgParts2)
        {
            float proteinSum  = orgParts1.proteins + orgParts2.proteins;
            float fatsSum     = orgParts1.fats + orgParts2.fats;
            float carbsSum    = orgParts1.carbs + orgParts2.carbs;
            float vitaminsSum = orgParts1.vitamins + orgParts2.vitamins;
            float mineralsSum = orgParts1.minerals + orgParts2.minerals;

            OrganicParts sum = new OrganicParts(proteinSum, fatsSum, carbsSum, vitaminsSum, mineralsSum);

            return(sum);
        }
示例#6
0
        public static OrganicParts operator *(OrganicParts orgParts1, float multiplier)
        {
            multiplier /= 100;

            float proteinSum  = orgParts1.proteins * multiplier;
            float fatsSum     = orgParts1.fats * multiplier;
            float carbsSum    = orgParts1.carbs * multiplier;
            float vitaminsSum = orgParts1.vitamins * multiplier;
            float mineralsSum = orgParts1.minerals * multiplier;

            OrganicParts sum = new OrganicParts(proteinSum, fatsSum, carbsSum, vitaminsSum, mineralsSum);

            return(sum);
        }