private void OnTriggerEnter(Collider collision) { if (collision.gameObject.GetComponent <AttIngredients>()) { ComandaChef send_comanda = collision.gameObject.GetComponent <AttIngredients>().GetHamburguer(); controladorPartidaChef.current.arriveComanda(send_comanda); Destroy(collision.gameObject, 0.5f); this.gameObject.SetActive(false); //Efectos de explosión } }
public void arriveComanda(ComandaChef comanda) { feedbackGenerator.setActualOrder(orderGenerator.getComandaActual()); // We define the command generated in the class that generates the feedback. (string, float)feedback = feedbackGenerator.getFeedback(comanda, this.timeActualOrder); // Get one string with feedback and a corresponding integer a score received. UIController.showFeedback(feedback.Item1); // We show the feedback text message on the screen. if (feedback.Item2 > 1) { if (this.orderGenerator.getComandaActual().type == "basic") { userControl.setNumBasicOrdersChef(userControl.getNumBasicOrdersChef() + 1); userControl.setNumOrdersChef(userControl.getNumOrdersChef() + 1); } else if (this.orderGenerator.getComandaActual().type == "conditionalIf") { userControl.setNumConditionalIfOrdersChef(userControl.getNumConditionalIfOrdersChef() + 1); userControl.setNumConditionalOrdersChef(userControl.getNumConditionalOrdersChef() + 1); userControl.setNumOrdersChef(userControl.getNumOrdersChef() + 1); } else if (this.orderGenerator.getComandaActual().type == "conditionalIfElse") { userControl.setNumConditionalIfElseOrdersChef(userControl.getNumConditionalIfElseOrdersChef() + 1); userControl.setNumConditionalOrdersChef(userControl.getNumConditionalOrdersChef() + 1); userControl.setNumOrdersChef(userControl.getNumOrdersChef() + 1); } else { userControl.setNumIterativeOrdersChef(userControl.getNumIterativeOrdersChef() + 1); userControl.setNumOrdersChef(userControl.getNumOrdersChef() + 1); } } if (this.userControl.getNumOrdersChef() == 1 && !this.userControl.getFirstOrderChefAchievement()) { //Activating 1 orders achievement this.userControl.setFirstOrderChefAchievement(true); } if (this.userControl.getNumOrdersChef() == 10 && !this.userControl.getTenOrdersChefAchievement()) { //Activating 10 orders achievement this.userControl.setTenOrdersChefAchievement(true); } else if (this.userControl.getNumOrdersChef() == 25 && !this.userControl.getTwentyfiveOrdersChefAchievement()) { this.userControl.setTwentyfiveOrdersChefAchievement(true); //Activating 25 orders achievement } if (this.userControl.getNumOrdersChef() == 50 && !this.userControl.getFiftyOrdersChefAchievement()) { //Activating 50 orders achievement this.userControl.setFiftyOrderChefAchievement(true); } else if (this.userControl.getNumOrdersChef() == 100 && !this.userControl.getHundredOrdersChefAchievement()) { //Activating 100 orders achievement this.userControl.setHundredOrdersChefAchievement(true); } if (this.userControl.getNumBasicOrdersChef() == 1 && !this.userControl.getFirstBasicOrderChefAchievement()) { //Activating 1 basic orders achievement this.userControl.setFirstBasicOrderChefAchievement(true); } else if (this.userControl.getNumBasicOrdersChef() == 10 && !this.userControl.getTenBasicOrdersChefAchievement()) { //Activating 10 basic orders achievement this.userControl.setTenBasicOrdersChefAchievement(true); isJustUnlockedLevel2 = true; } else if (this.userControl.getNumBasicOrdersChef() == 25 && !this.userControl.getTwentyfiveBasicOrdersChefAchievement()) { this.userControl.setTwentyfiveBasicOrdersChefAchievement(true); //Activating 25 basic orders achievement } else if (this.userControl.getNumConditionalOrdersChef() == 1 && !this.userControl.getFirstConditionalOrderChefAchievement()) { this.userControl.setFirstConditionalOrderChefAchievement(true); //Activating 1 conditional order achievement } else if (this.userControl.getNumConditionalOrdersChef() == 10 && !this.userControl.getTenConditionalOrdersChefAchievement()) { this.userControl.setTenConditionalOrdersChefAchievement(true); //Activating 10 conditional orders achievement } else if (this.userControl.getNumConditionalOrdersChef() == 50 && !this.userControl.getFiftyConditionalOrdersChefAchievement()) { this.userControl.setFiftyConditionalOrdersChefAchievement(true); //Activating 50 conditional orders achievement } else if (this.userControl.getNumConditionalIfOrdersChef() == 1 && !this.userControl.getFirstConditionalIfOrderChefAchievement()) { this.userControl.setFirstConditionalIfOrderChefAchievement(true); //Activating 1 basic conditional order achievement } else if (this.userControl.getNumConditionalIfOrdersChef() == 10 && !this.userControl.getTenConditionalIfOrdersChefAchievement()) { this.userControl.setTenConditionalIfOrdersChefAchievement(true); isJustUnlockedLevel3 = true; //Activating 10 basic conditional orders achievement } else if (this.userControl.getNumConditionalIfOrdersChef() == 30 && !this.userControl.getThirtyConditionalIfOrdersChefAchievement()) { this.userControl.setThirtyConditionalIfOrdersChefAchievement(true); //Activating 30 basic conditional orders achievement } else if (this.userControl.getNumConditionalIfElseOrdersChef() == 1 && !this.userControl.getFirstConditionalIfElseOrderChefAchievement()) { this.userControl.setFirstConditionalIfElseOrderChefAchievement(true); //Activating 1 double conditional order achievement } else if (this.userControl.getNumConditionalIfElseOrdersChef() == 10 && !this.userControl.getTenConditionalIfElseOrdersChefAchievement()) { isJustUnlockedLevel4 = true; this.userControl.setTenConditionalIfElseOrdersChefAchievement(true); //Activating 10 double conditional orders achievement } else if (this.userControl.getNumConditionalIfElseOrdersChef() == 30 && !this.userControl.getThirtyConditionalIfElseOrdersChefAchievement()) { this.userControl.setThirtyConditionalIfElseOrdersChefAchievement(true); isJustUnlockedLevel4 = true; //Activating 30 double conditional orders achievement } else if (this.userControl.getNumIterativeOrdersChef() == 1 && !this.userControl.getFirstIterativeOrderChefAchievement()) { //Activating 1 iterative order achievement this.userControl.setFirstIterativeOrderChefAchievement(true); } else if (this.userControl.getNumIterativeOrdersChef() == 10 && !this.userControl.getTenIterativeOrdersChefAchievement()) { //Activating 10 iterative orders achievement this.userControl.setTenIterativeOrdersChefAchievement(true); } else if (this.userControl.getNumIterativeOrdersChef() == 30 && !this.userControl.getThirtyIterativeOrdersChefAchievement()) { this.userControl.setThirtyIterativeOrdersChefAchievement(true); //Activating 30 iterative orders achievement } dayExp += feedback.Item2; // Sumamos la experiencia de esta comanda a la experiencia del día. isComandaShowingUp = false; // Desactivamos la flag de mostrar la comanda. this.timeActualOrder = 0f; // Reiniciamos el tiempo. }
// Start is called before the first frame update void Start() { current_hamburguer = new ComandaChef(); }
public (string, float) getFeedback(ComandaChef order, float time) { ArrayList ingredients = order.getIngredients(); ArrayList ingredients_screen = new ArrayList(actualOrder.ingredients); string result_str; bool result = true; int index = 0; int exp = 0; if (actualOrder.type == "basic" || actualOrder.type == "iter") { if (ingredients.Count > ingredients_screen.Count) { result_str = "You put too many ingredients!"; return(result_str, 0f); } else if (ingredients.Count < ingredients_screen.Count && ingredients.Count > 0) { return("You still have ingredients to put. Don't give up!", 0); } foreach (GameObject ingredient in ingredients) { if (result) { if (ingredient.gameObject.name == "Hamburguer") { return("Oh no ! You have to coock the hamburguer !", 0); } result = ingredient.gameObject.name.Equals(ingredients_screen[index]); index++; } else { return("The ingredients are unordered, or you don't have to put " + ingredient.name + " in the hamburguer", 0); } } } else if (actualOrder.type == "conditionalIf") { var conditionalIngredient = actualOrder.offset[0]; var signo = actualOrder.offset[1]; var minimumCardinality = System.Convert.ToInt32(actualOrder.offset[2]); var posicionCondicional = System.Convert.ToInt32(actualOrder.offset[3]); var isConditionTrue = false; var ingCond = conditionalIngredient; if (conditionalIngredient == "CoockedHamburguer") { ingCond = "Hamburguer"; } if (controladorPartidaChef.current.getCardinalityController().getCardinality(ingCond) > minimumCardinality) { isConditionTrue = true; } foreach (GameObject ingredient in ingredients) { if (ingredients.Count > ingredients_screen.Count) { result_str = "You put too many ingredients!"; return(result_str, 0f); } else if (ingredients.Count < ingredients_screen.Count - 1 && ingredients.Count > 0) { return("You still have ingredients to put. Don't give up!", 0f); } else if (ingredients.Count == 0) { return("You have to put ingredients!", 0); } if (result) { if (ingredient.gameObject.name == "Hamburguer") { return("Oh no! You have to coock the hamburguer !", 0); } if (index == posicionCondicional) { if (ingredient.gameObject.name.Equals(ingredients_screen[index]) && !isConditionTrue) { return("You dont't have enough " + conditionalIngredient + " to put in!", 0); } else if (ingredient.gameObject.name.Equals(ingredients_screen[index + 1]) && isConditionTrue) { return("You have enough " + conditionalIngredient + " to put in!", 0); } else if (ingredient.gameObject.name.Equals(ingredients_screen[index + 1]) && !isConditionTrue) { index++; } result = ingredient.gameObject.name.Equals(ingredients_screen[index]); } else { result = ingredient.gameObject.name.Equals(ingredients_screen[index]); } index++; } else { return("The ingredients are unordered, or you don't have to put " + ingredient.name + " in the hamburguer", 0); } } } else if (actualOrder.type == "conditionalIfElse") { var ingredientConditional = actualOrder.offset[0]; var minimumCardinality = System.Convert.ToInt32(actualOrder.offset[3]); var posicionCondicional = System.Convert.ToInt32(actualOrder.offset[4]); var isConditionTrue = false; var ingCond = ingredientConditional; if (ingredientConditional == "CoockedHamburguer") { ingCond = "Hamburguer"; } if (controladorPartidaChef.current.getCardinalityController().getCardinality(ingCond) >= minimumCardinality) { isConditionTrue = true; } foreach (GameObject ingredient in ingredients) { if (ingredients.Count > ingredients_screen.Count - 1) { result_str = "You put too many ingredients!"; return(result_str, 0f); } else if (ingredients.Count < ingredients_screen.Count - 1 && ingredients.Count > 0) { return("You still have ingredients to put. Don't give up!", 0f); } else if (ingredients.Count == 0) { return("You have to put ingredients!", 0); } if (result) { if (ingredient.gameObject.name == "Hamburguer") { return("Oh no! You have to coock the hamburguer !", 0); } if (index == posicionCondicional) { if (ingredient.gameObject.name.Equals(ingredients_screen[index]) && !isConditionTrue) { return("You dont't have enough " + ingredientConditional + " to put in!", 0); } else if (ingredient.gameObject.name.Equals(ingredients_screen[index + 1]) && isConditionTrue) { return("You have enough " + ingredientConditional + " to put in!", 0); } else if (ingredient.gameObject.name.Equals(ingredients_screen[index + 1]) && !isConditionTrue) { index++; } result = ingredient.gameObject.name.Equals(ingredients_screen[index]); } else { result = ingredient.gameObject.name.Equals(ingredients_screen[index]); } index++; } else { return("The ingredients are unordered, or you don't have to put " + ingredient.name + " in the hamburguer", 0); } } } if (result && index > 0) { if (time > 10f) { exp = 25; } else if (time < 10f) { exp = 100; } return("Succes!", exp); } return("You have to put ingredients!", 0); }