Your Recent Sets
Recently Viewed Sets
Favorite Sets
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
ourTotalIngredientCosts += ingredientCost *
ingredientAmounts[i];
}
firstRun = false;
}
for (int i = 0; i < ingredientList.Length; i++)
{
if (ingredientAmounts[i] <= 0)
{
//if we have 0 of an ingredient we cannot make more
tacos, we are done
Debug.Log("Returning info:");
Debug.Log("Total available Tacos: " + totalAvailableTacos)
;
Debug.Log("Total charge for Tacos: " +
totalChargeForTacos);
Debug.Log("Total Ingredient Cost (used and unused): " +
ourTotalIngredientCosts);
return;
}
else
{
ingredientAmounts[i]--;
//if every ingredient is the same price we can add here
but realistically it would probably have variable price
//I might add a third array of price for the items and
would possiblly create a struct or similar to begin accounting
//for multiple toppings, costs, etc, I uses two arrays
since we are working in a fairly simple capacity here
//returnInfo.totalChargeForTacos += cost etc etc.
}
}
//we have made a taco by taking out one of each ingredient, go
again
totalAvailableTacos++;
//as mentioned I am assuming a flat price per ingredient, so we
can simply multiply by 5 here
//we also add a randomly generated range for the estimated tip
totalChargeForTacos += (ingredientCost * 5) + UnityEngine.Random.
Range(0.08f, 0.16f);
CalcInventory(ingredientList, ingredientAmounts, ingredientCost);
}
}
Enter to Rename, Shift+Enter to Preview