public int ReturnDoughScore(Constants.PizzaSizes size) { //0,1,2,3 Constants.PizzaSizes mysize = Constants.PizzaSizes.tooSmall; totalDistance = 0; averageDistance = 0; for (int x = 0; x < PizzaManager.SharedInstance.doughMeshScript.BonePos.Length; x++) { totalDistance += Vector3.Distance(PizzaManager.SharedInstance.doughMeshScript.BonePos[x].position, PizzaManager.SharedInstance.currentPizzaObject.transform.position); } Debug.Log("Current pizza total: " + totalDistance); averageDistance = totalDistance / PizzaManager.SharedInstance.doughMeshScript.BonePos.Length; Debug.Log("Current pizza average: " + averageDistance); if (averageDistance < Constants.MIN_SMALL_PIZZA) { mysize = Constants.PizzaSizes.tooSmall; } else if (averageDistance >= Constants.MIN_SMALL_PIZZA && averageDistance <= Constants.MAX_SMALL_PIZZA) { mysize = Constants.PizzaSizes.small; } else if (averageDistance >= Constants.MIN_MEDIUM_PIZZA && averageDistance <= Constants.MAX_SMALL_PIZZA) { mysize = Constants.PizzaSizes.medium; } else if (averageDistance >= Constants.MIN_LARGE_PIZZA && averageDistance <= Constants.MAX_LARGE_PIZZA) { mysize = Constants.PizzaSizes.large; } else if (averageDistance >= Constants.MAX_LARGE_PIZZA) { mysize = Constants.PizzaSizes.tooLarge; } if (mysize == size) { return(0); } else if (mysize > size) { return(-10); } else if (mysize < size) { return(-15); } Debug.LogWarning("failed check"); return(0); }
public void CreateOrder() { Debug.Log("Order Incoming!"); int size = Random.Range(1, 4); PizzaOrderSize = (Constants.PizzaSizes)size; MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.dough, size); Debug.Log(PizzaOrderSize.ToString() + " pizza."); int sauceMyPizza = Random.Range(0, 10); if (sauceMyPizza == minSpecialOrder) { //nosauce Debug.Log("NO SAUCE."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.sauce, 0); } else { int sauceOrder = Random.Range(0, 10); NoSauce = false; if (sauceOrder <= minSpecialOrder) { SauceAmount = ToppingAmounts.light; Debug.Log("Light Sauce."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.sauce, 1); } else if (sauceOrder >= maxSpecialOrder) { SauceAmount = ToppingAmounts.extra; Debug.Log("Extra Sauce."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.sauce, 3); } else { SauceAmount = ToppingAmounts.regular; Debug.Log("Regular Sauce."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.sauce, 2); } } int cheeseMyPizza = Random.Range(0, 10); if (cheeseMyPizza == minSpecialOrder) { //nocheese Debug.Log("NO CHEESE!"); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.cheese, 0); } else { NoCheese = false; int cheeseOrder = Random.Range(0, 10); if (cheeseOrder <= minSpecialOrder) { CheeseAmount = ToppingAmounts.light; Debug.Log("Light Cheese."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.cheese, 1); } else if (cheeseOrder >= maxSpecialOrder) { CheeseAmount = ToppingAmounts.extra; Debug.Log("Extra Cheese."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.cheese, 3); } else { CheeseAmount = ToppingAmounts.regular; Debug.Log("Regular Cheese."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.cheese, 2); } } Debug.LogWarning("start toppings"); List <Constants.PlayerToppings> RandomToppings = new List <Constants.PlayerToppings>(MenuManager.Instance.AvailableToppingsForPlayers); int NumberOfToppings = Random.Range(0, RandomToppings.Count); //shuffle list for (int i = 0; i < RandomToppings.Count; i++) { Constants.PlayerToppings temp = RandomToppings[i]; int randomIndex = Random.Range(i, RandomToppings.Count); RandomToppings[i] = RandomToppings[randomIndex]; RandomToppings[randomIndex] = temp; } MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pepperoni, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.bacon, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.anchovies, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pineapple, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.greenPepper, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.hotPepper, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.mushroom, 0); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.spinach, 0); for (int x = 0; x <= NumberOfToppings; x++) { if (RandomToppings[x] == Constants.PlayerToppings.pepperoni) { //do pepperoni NoPepperoni = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { PepperoniAmount = ToppingAmounts.light; Debug.Log("Light Pepperoni."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pepperoni, 1); } else if (specialOrder >= maxSpecialOrder) { PepperoniAmount = ToppingAmounts.extra; Debug.Log("Extra Pepperoni."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pepperoni, 3); } else { Debug.Log("Pepperoni."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pepperoni, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.bacon) { //do bacon NoBacon = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { BaconAmount = ToppingAmounts.light; Debug.Log("Light Bacon."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.bacon, 1); } else if (specialOrder >= maxSpecialOrder) { BaconAmount = ToppingAmounts.extra; Debug.Log("Extra Bacon."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.bacon, 3); } else { Debug.Log("Bacon."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.bacon, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.anchovies) { //do anchovies NoAnchovies = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { AnchoviesAmount = ToppingAmounts.light; Debug.Log("Light Anchovies."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.anchovies, 1); } else if (specialOrder >= maxSpecialOrder) { AnchoviesAmount = ToppingAmounts.extra; Debug.Log("Extra Anchovies."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.anchovies, 3); } else { Debug.Log("Anchovies."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.anchovies, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.greenPepper) { //do greenpepper NoGreenPepper = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { GreenPepperAmount = ToppingAmounts.light; Debug.Log("Light GreenPepper."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.greenPepper, 1); } else if (specialOrder >= maxSpecialOrder) { GreenPepperAmount = ToppingAmounts.extra; Debug.Log("Extra GreenPepper."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.greenPepper, 3); } else { Debug.Log("GreenPepper."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.greenPepper, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.mushroom) { //do mushroom NoMushroom = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { MushroomAmount = ToppingAmounts.light; Debug.Log("Light Mushroom."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.mushroom, 1); } else if (specialOrder >= maxSpecialOrder) { MushroomAmount = ToppingAmounts.extra; Debug.Log("Extra Mushroom."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.mushroom, 3); } else { Debug.Log("Mushroom."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.mushroom, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.hotPepper) { //do hotppepper NoHotPepper = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { HotPepperAmount = ToppingAmounts.light; Debug.Log("Light HotPepper."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.hotPepper, 1); } else if (specialOrder >= maxSpecialOrder) { HotPepperAmount = ToppingAmounts.extra; Debug.Log("Extra HotPepper."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.hotPepper, 3); } else { Debug.Log("HotPepper."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.hotPepper, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.pineapple) { //do pineapple NoPineapple = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { PineappleAmount = ToppingAmounts.light; Debug.Log("Light Pineapple."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pineapple, 1); } else if (specialOrder >= maxSpecialOrder) { PineappleAmount = ToppingAmounts.extra; Debug.Log("Extra Pineapple."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pineapple, 3); } else { Debug.Log("Pineapple."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.pineapple, 2); } } else if (RandomToppings[x] == Constants.PlayerToppings.spinach) { //do spinach NoSpinach = false; int specialOrder = Random.Range(0, 10); if (specialOrder <= minSpecialOrder) { SpinachAmount = ToppingAmounts.light; Debug.Log("Light Spinach."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.spinach, 1); } else if (specialOrder >= maxSpecialOrder) { SpinachAmount = ToppingAmounts.extra; Debug.Log("Extra Spinach."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.spinach, 3); } else { Debug.Log("Spinach."); MenuManager.Instance.HUD.HandleNewPizza(Constants.Toppings.spinach, 2); } } else { Debug.Log("missing: " + RandomToppings[x].ToString()); Debug.LogError("oops. " + x); } } Debug.Log("Order ended."); }
void ScoreTopping(Constants.Toppings toppingType, int numberOftoppingsOnPizza, bool isNotRequested, ToppingAmounts toppAmount, Constants.PizzaSizes pizzasize) //, Vector2 lightTopps, Vector2 regularTopps, Vector2 extraTopps) { int toppingSizeModifier = Constants.SMALL_TOPPING_MODIFIER; int toppingSizeModifierMax = toppingSizeModifier + 1; if (pizzasize == Constants.PizzaSizes.medium) { toppingSizeModifier = Constants.MEDIUM_TOPPING_MODIFIER; toppingSizeModifierMax = toppingSizeModifier + 1; } else if (pizzasize == Constants.PizzaSizes.large) { toppingSizeModifier = Constants.LARGE_TOPPING_MODIFIER; toppingSizeModifierMax = toppingSizeModifier + 1; } int toppingExtraModifier = Constants.LIGHT_TOPPING_MODIFIER; if (toppAmount == ToppingAmounts.regular) { toppingExtraModifier = Constants.REGULAR_TOPPING_MODIFIER; } else if (toppAmount == ToppingAmounts.extra) { toppingExtraModifier = Constants.EXTRA_TOPPING_MODIFIER; } if (toppingType == Constants.Toppings.sauce) { minimumToppings = Constants.DEFAULT_SAUCE_AMOUNT * toppingSizeModifier * toppingExtraModifier; maximumToppings = Constants.DEFAULT_SAUCE_AMOUNT * toppingSizeModifierMax * toppingExtraModifier; } else if (toppingType == Constants.Toppings.cheese) { minimumToppings = Constants.DEFAULT_CHEESE_AMOUNT * toppingSizeModifier * toppingExtraModifier; maximumToppings = Constants.DEFAULT_CHEESE_AMOUNT * toppingSizeModifierMax * toppingExtraModifier; } else { minimumToppings = Constants.DEFAULT_TOPPING_AMOUNT * toppingSizeModifier * toppingExtraModifier; maximumToppings = Constants.DEFAULT_TOPPING_AMOUNT * toppingSizeModifierMax * toppingExtraModifier; } Debug.Log("Topping: " + toppingType); Debug.Log("minimum toppings: " + minimumToppings); Debug.Log("maximum toppings: " + maximumToppings); if (!isNotRequested)//if requested { Debug.Log("Number on pizza of " + toppingType + " :" + numberOftoppingsOnPizza); if (numberOftoppingsOnPizza > minimumToppings && numberOftoppingsOnPizza < maximumToppings) { //dont deduct points } else if (numberOftoppingsOnPizza < minimumToppings) { DeductScore(10); } else if (numberOftoppingsOnPizza > maximumToppings) { DeductScore(10); } } else if (isNotRequested) { Debug.Log("Entered not requested"); if (numberOftoppingsOnPizza > 0) { DeductScore(15); Debug.LogWarning("I SAID NO"); } } }