public void DisplayMainMenu(Soup soup, Order orderToDisplay) { DisplayMainMenu(orderToDisplay); if (soup != null) { canonSpicyText.text = "Spicy " + "[" + soup.spicyValue.ToString() + "]"; canonChunkyText.text = "Chunky " + "[" + soup.chunkyValue.ToString() + "]"; canonSweetnessText.text = "Sweet " + "[" + soup.sweetnessValue.ToString() + "]"; if (soup.spicyValue >= OrderManager.CalculateLowerHalf(orderToDisplay.spicyness) && soup.spicyValue <= OrderManager.CalculateUpperHalf(orderToDisplay.spicyness)) { canonSpicyText.color = Color.green; } else { canonSpicyText.color = Color.red; } if (soup.chunkyValue >= OrderManager.CalculateLowerHalf(orderToDisplay.chunkiness) && soup.chunkyValue <= OrderManager.CalculateUpperHalf(orderToDisplay.chunkiness)) { canonChunkyText.color = Color.green; } else { canonChunkyText.color = Color.red; } if (soup.sweetnessValue >= OrderManager.CalculateLowerHalf(orderToDisplay.sweetness) && soup.sweetnessValue <= OrderManager.CalculateUpperHalf(orderToDisplay.sweetness)) { canonSweetnessText.color = Color.green; } else { canonSweetnessText.color = Color.red; } if (soup.colour.name == orderToDisplay.colourPreference.name) { canonColourText.color = Color.green; } else { canonColourText.color = Color.red; } // Displaying meat veg preference // if (soup.ContainsMeat() && soup.ContainsVeg()) { canonMeatText.text = "Contains meat and veg"; if (!orderToDisplay.noMeat && !orderToDisplay.noVeg) { canonMeatText.color = Color.green; } else { canonMeatText.color = Color.red; } } else if (soup.ContainsMeat()) { canonMeatText.text = "Contains meat"; if (!orderToDisplay.noMeat) { canonMeatText.color = Color.green; } else { canonMeatText.color = Color.red; } } else if (soup.ContainsVeg()) { canonMeatText.text = "Contains veg"; if (!orderToDisplay.noVeg) { canonMeatText.color = Color.green; } else { canonMeatText.color = Color.red; } } else { canonMeatText.text = "Theres no ingredients"; canonMeatText.color = Color.red; } // ----------------------------- // canonColourText.text = "Colour " + "[" + soup.colour.name + "]"; } else { canonSpicyText.text = "Spicy " + "[" + "-" + "]"; canonChunkyText.text = "Chunky " + "[" + "-" + "]"; canonSweetnessText.text = "Sweet " + "[" + "-" + "]"; // Displaying meat veg preference // canonMeatText.text = "Meat/Veg [-]"; // ----------------------------- // canonColourText.text = "Colour " + "[" + "-" + "]"; // Resetting Colours // canonSpicyText.color = Color.white; canonSweetnessText.color = Color.white; canonChunkyText.color = Color.white; canonColourText.color = Color.white; canonMeatText.color = Color.white; } }
private bool CompareOrder(Soup soupToSubmit) { bool isSuccessfulOrder = true; int chunkynessDifference; int spicynessDifference; int sweetnessDifference; spicynessDifference = (int)soupToSubmit.spicyValue - (int)acceptedOrders[0].spicyness; chunkynessDifference = (int)soupToSubmit.chunkyValue - (int)acceptedOrders[0].chunkiness; sweetnessDifference = (int)soupToSubmit.sweetnessValue - (int)acceptedOrders[0].sweetness; // Early out if the player submitted empty capsule. // if (soupToSubmit.usedIngredients.Count == 0) { isSuccessfulOrder = false; return(false); } // --------------------------------- Spicyness --------------------------------- // if (spicynessDifference == 0) { RewardPoints(perfectRequirementPoints); RewardTime(perfectRequirementTime); Debug.Log("Perfect spicyness acheived."); } else if (spicynessDifference > CalculateLowerHalf((float)acceptedOrders[0].spicyness) && spicynessDifference < CalculateUpperHalf((int)acceptedOrders[0].spicyness)) { RewardPoints(acaceptableRequirementPoints); RewardTime(acceptableRequirementTime); Debug.Log("Acceptable spicyness acheived."); } else { Debug.Log("Failed spicyness"); isSuccessfulOrder = false; } // ----------------------------------------------------------------------------- // // --------------------------------- Chunkyness --------------------------------- // if (chunkynessDifference == 0) { RewardPoints(perfectRequirementPoints); RewardTime(perfectRequirementTime); Debug.Log("Perfect chunkyness acheived."); } else if (chunkynessDifference > CalculateLowerHalf((float)acceptedOrders[0].chunkiness) && chunkynessDifference < CalculateUpperHalf((int)acceptedOrders[0].chunkiness)) { RewardPoints(acaceptableRequirementPoints); RewardTime(acceptableRequirementTime); Debug.Log("Acceptable chunkyness acheived."); } else { Debug.Log("Failed chunkyness"); isSuccessfulOrder = false; } // -------------------------------------------------------------------------------- // // --------------------------------- Sweetness --------------------------------- // if (sweetnessDifference == 0) { RewardPoints(perfectRequirementPoints); RewardTime(perfectRequirementTime); Debug.Log("Perfect sweetness acheived."); } else if (sweetnessDifference > CalculateLowerHalf((float)acceptedOrders[0].sweetness) && sweetnessDifference < CalculateUpperHalf((int)acceptedOrders[0].sweetness)) { RewardPoints(acaceptableRequirementPoints); RewardTime(acceptableRequirementTime); Debug.Log("Acceptable sweetness acheived."); } else { Debug.Log("Failed sweetness"); isSuccessfulOrder = false; } // ------------------------------------------------------------------------------ // // --------------------------------- Colours --------------------------------- // if (soupToSubmit.colour.name == acceptedOrders[0].colourPreference.name) { RewardPoints(perfectRequirementPoints); RewardTime(perfectRequirementTime); Debug.Log("Got colour correct."); } else { isSuccessfulOrder = false; Debug.Log("Got colour incorrect."); } // --------------------------------------------------------------------------- // // --------------------------------- Food Requirement --------------------------------- // if (soupToSubmit.ContainsMeat() && acceptedOrders[0].noMeat) { isSuccessfulOrder = false; } else if (soupToSubmit.ContainsVeg() && acceptedOrders[0].noVeg) { isSuccessfulOrder = false; } else { // This if statement makes sure the player doesn't just submit empty capsules. // if (soupToSubmit.usedIngredients.Count > 0) { RewardPoints(perfectRequirementPoints); RewardTime(perfectRequirementTime); Debug.Log("Got food specification requirement correct."); } } // ------------------------------------------------------------------------------------- // // Returning true or false depending if the order was successful. // if (isSuccessfulOrder) { return(true); } else { return(false); } }