public void deleteHamburguer()
 {
     foreach (GameObject panel in currentHamburguer.getInstructions())
     {
         Destroy(panel);
     }
     currentHamburguer = new OrderWaiter();
 }
    public (string, float, bool) getFeedback(OrderWaiter order, float time)
    {
        ArrayList instructions        = order.getInstructions();
        ArrayList instructions_screen = new ArrayList(actualOrder.instructions);

        string result_str;

        bool result = true;
        int  index  = 0;
        int  exp    = 0;

        if (instructions.Count > instructions_screen.Count)
        {
            result_str = "You put too many instructions. Try again!";

            return(result_str, 0f, false);
        }
        else if (instructions.Count < instructions_screen.Count && instructions.Count > 0)
        {
            return("You still have instructions to put. Don't give up!", 0f, false);
        }
        foreach (GameObject instruction in instructions)
        {
            if (result)
            {
                result = instruction.gameObject.name.Equals(instructions_screen[index]);
                index++;
            }
            else
            {
                return("The instructions are unordered. Try again", 0, false);
            }
        }
        if (result && index > 0)
        {
            if (time > 20f)
            {
                exp = 25;
            }
            else if (time < 20f)
            {
                exp = 100;
            }

            return("Succes! Let's go for another order!", exp, true);
        }
        result_str = "Incorrect! Try again";

        return(result_str, 0f, false);
    }
Exemple #3
0
        public async Task <OrderWaiter> DeleteOrderWaiter(int orderWaiterId)
        {
            OrderWaiter dbEntry = dbContext.OrderWaiters.Find(orderWaiterId);

            if (dbEntry == null)
            {
                throw new InvalidOperationException("Order waiter not found");
            }
            dbContext.OrderWaiters.Remove(dbEntry);

            await dbContext.SaveChangesAsync();

            return(dbEntry);
        }
Exemple #4
0
        public async Task <int> SaveOrderWaiter(OrderWaiter orderWaiter)
        {
            if (orderWaiter == null)
            {
                throw new ArgumentNullException(nameof(orderWaiter), "Parameter is null");
            }
            if (orderWaiter.Id == 0)
            {
                dbContext.OrderWaiters.Add(orderWaiter);
            }

            await dbContext.SaveChangesAsync();

            return(orderWaiter.Id);
        }
    public void OnButtonDown()
    {
        panel = GameObject.Find("BasicPanel");

        //Enviamos el pedido para ver si está bien



        OrderWaiter sendOrder = panel.GetComponent <AttInstructions>().GetHamburguer();

        GameControllerWaiter.current.arriveOrder(sendOrder);


        //Devolvemos el botón a su lugar inicial 2 segundos más tarde de haberlo pulsado
        StartCoroutine("Waiting");
        StartCoroutine("ButtonUp");
    }
    // Start is called before the first frame update
    void Start()
    {
        currentHamburguer = new OrderWaiter();

        //pruebas
    }
Exemple #7
0
    public void arriveOrder(OrderWaiter order)
    {
        //Este if lo utilizamos por si el día acaba a mitad del pedido ("explicado" en el tutorial)
        if (isComandaActive)
        {
            feedbackGenerator.setComandaActual(orderGenerator.getActualOrder());                         //Definimos la comanda generada en la clase que generará el feedback.
            (string, float, bool)feedback = feedbackGenerator.getFeedback(order, this.timeCurrentOrder); // Obtenemos una string con el feedback, un entero correspondiente a la puntuación recibida y un booleano para saber si la entrega ha sido correcta
            controllerMenus.mostrarFeedback(feedback.Item1);                                             //Mostramos en pantalla el mensaje de texto del feedback.

            if (!feedback.Item3)
            {
                //El pedido ha sido incorrecto, ponemos el mensaje por pantalla y hacemos que vuelva a salir el pedido que hay que realizar
                AudioSource.PlayClipAtPoint(ButtonSoundIncorrect, Button.transform.position, 1.0f);
                OVRInput.SetControllerVibration(5, 200, OVRInput.Controller.RTouch);
                OVRInput.SetControllerVibration(5, 200, OVRInput.Controller.LTouch);
                Button.GetComponent <MeshRenderer>().material = redMatButton;
                smokeSystem.Play();
                StartCoroutine("Waiting");
                StartCoroutine("Again");
            }
            else if (feedback.Item3)
            {
                Button.GetComponent <MeshRenderer>().material = greenMatButton;
                AudioSource.PlayClipAtPoint(ButtonSoundCorrect, Button.transform.position, 1.0f);
                deleteInstructions();
                isComandaActive = false; // Desactivamos la flag de mostrar la comanda.
                isTableChoosed  = false;
                textsClient[randomIndex].SetActive(false);
            }


            if (feedback.Item2 > 1)
            {
                if (this.orderGenerator.getActualOrder().level == "1" || this.orderGenerator.getActualOrder().level == "2")
                {
                    userControl.setNumBasicOrdersWaiter(userControl.getNumBasicOrdersWaiter() + 1);
                    userControl.setNumOrdersWaiter(userControl.getNumOrdersWaiter() + 1);
                }
                else if (this.orderGenerator.getActualOrder().level == "3")
                {
                    userControl.setNumConditionalIfOrdersWaiter(userControl.getNumConditionalIfOrdersWaiter() + 1);
                    userControl.setNumOrdersWaiter(userControl.getNumOrdersWaiter() + 1);
                    userControl.setNumConditionalOrdersWaiter(userControl.getNumConditionalOrdersWaiter() + 1);
                }

                else if (this.orderGenerator.getActualOrder().level == "4")
                {
                    userControl.setNumConditionalIfElseOrdersWaiter(userControl.getNumConditionalIfElseOrdersWaiter() + 1);
                    userControl.setNumOrdersWaiter(userControl.getNumOrdersWaiter() + 1);
                    userControl.setNumConditionalOrdersWaiter(userControl.getNumConditionalOrdersWaiter() + 1);
                }
                else
                {
                    userControl.setNumIterativeOrdersWaiter(userControl.getNumIterativeOrdersWaiter() + 1);
                    userControl.setNumOrdersWaiter(userControl.getNumOrdersWaiter() + 1);
                }


                if (this.userControl.getNumBasicOrdersWaiter() == 1 && !this.userControl.getFirstOrderWaiterAchievement())
                {
                    this.userControl.setFirstOrderWaiterAchievement(true);
                    isJustUnlockedLevel2    = true;
                    AchievementUnlockedClip = Resources.Load <AudioClip>("Audio/FirstBasicOrderAudio");
                    AudioSource.PlayClipAtPoint(AchievementUnlockedClip, Button.transform.position, 1.0f);
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: First Basic Order Done! Congratulations, keep going on");
                    controllerMenus.showImageBig(true, "LogroNormal2");
                    controllerMenus.activeButtonText(false);
                    arrowPointer.SetActive(false);

                    hatTv.GetComponent <MeshRenderer>().material = Resources.Load <Material>("Materials/green");
                }
                else if (this.userControl.getNumBasicOrdersWaiter() == 10 && !this.userControl.getTwentyfiveBasicOrdersWaiterAchievement())
                {
                    isJustUnlockedLevel3 = true;
                    this.userControl.setTwentyfiveBasicOrdersWaiterAchievement(true);
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Ten Basic Orders Done! Congratulations, level up!");

                    controllerMenus.showImageBig(true, "LogroNormal3");

                    hatTv.GetComponent <MeshRenderer>().material = Resources.Load <Material>("Materials/blue");
                    //Activar logro 20 comandas normales
                }

                else if (this.userControl.getNumConditionalIfOrdersWaiter() == 1 && !this.userControl.getFirstConditionalIfOrderWaiterAchievement())
                {
                    this.userControl.setFirstConditionalIfOrderWaiterAchievement(true);
                    isJustUnlockedLevel4 = true;
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: First Basic Conditional Order Done! Congratulations, leveled up!");
                    controllerMenus.showImageBig(true, "LogroCondicional1");

                    hatTv.GetComponent <MeshRenderer>().material = Resources.Load <Material>("Materials/red");

                    //Activar logro 1 comandas condicional
                }
                else if (this.userControl.getNumConditionalIfOrdersWaiter() == 10 && !this.userControl.getTenConditionalIfOrdersWaiterAchievement())
                {
                    this.userControl.setTenConditionalIfOrdersWaiterAchievement(true);
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Ten Basic Conditional Orders Done! Congratulations, keep it up!");
                    controllerMenus.showImageBig(true, "LogroCondicional2");
                    //Activar logro 10 comandas condicional
                }
                else if (this.userControl.getNumConditionalIfOrdersWaiter() == 30 && !this.userControl.getThirtyConditionalIfOrdersWaiterAchievement())
                {
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Thirty Basic Conditional Orders Done! Congratulations, keep it up!");
                    this.userControl.setThirtyConditionalIfOrdersWaiterAchievement(true);
                    controllerMenus.showImageBig(true, "LogroCondicional3");
                    //Activar logro 30 comandas condicionals
                }
                else if (this.userControl.getNumConditionalIfElseOrdersWaiter() == 1 && !this.userControl.getFirstConditionalIfElseOrderWaiterAchievement())
                {
                    this.userControl.setFirstConditionalIfElseOrderWaiterAchievement(true);
                    isJustUnlockedLevel5 = true;
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: First Double Conditional Order Done! Congratulations, leveled up!");
                    controllerMenus.showImageBig(true, "LogroCondicional1");

                    hatTv.GetComponent <MeshRenderer>().material = Resources.Load <Material>("Materials/gold");
                    //Activar logro 1 comandas condicional
                }
                else if (this.userControl.getNumConditionalIfElseOrdersWaiter() == 10 && !this.userControl.getTenConditionalIfElseOrdersWaiterAchievement())
                {
                    this.userControl.setTenConditionalIfElseOrdersWaiterAchievement(true);
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Ten Double Conditional Orders Done! Congratulations, keep it up!");
                    controllerMenus.showImageBig(true, "LogroCondicional2");
                    //Activar logro 10 comandas condicional
                }
                else if (this.userControl.getNumConditionalIfElseOrdersWaiter() == 30 && !this.userControl.getThirtyConditionalIfElseOrdersWaiterAchievement())
                {
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Thirty Double Conditional Order Done! Congratulations, keep it up!");
                    this.userControl.setThirtyConditionalIfElseOrdersWaiterAchievement(true);
                    controllerMenus.showImageBig(true, "LogroCondicional3");
                    //Activar logro 30 comandas condicionals
                }
                else if (this.userControl.getNumIterativeOrdersWaiter() == 1 && !this.userControl.getFirstConditionalIfElseOrderWaiterAchievement())
                {
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: First Iterative Order Done! Congratulations, keep it up!");
                    controllerMenus.showImageBig(true, "LogroFOR1");
                    //Activar logro 1 comandas iterativas
                    this.userControl.setFirstConditionalIfElseOrderWaiterAchievement(true);
                }
                else if (this.userControl.getNumIterativeOrdersWaiter() == 10 && !this.userControl.getTenConditionalIfElseOrdersWaiterAchievement())
                {
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Ten Iterative Orders Done! Congratulations, keep it up!");
                    controllerMenus.showImageBig(true, "LogroFOR2");
                    //Activar logro 10 comandas iterativas
                    this.userControl.setTenIterativeOrdersWaiterAchievement(true);
                }
                else if (this.userControl.getNumIterativeOrdersWaiter() == 30 && !this.userControl.getThirtyConditionalIfElseOrdersWaiterAchievement())
                {
                    controllerMenus.orderMenuWaiter("Success! Achievement Unlocked: Thirty Iterative Orders Done! Congratulations, keep it up!");
                    this.userControl.setThirtyConditionalIfElseOrdersWaiterAchievement(true);
                    controllerMenus.showImageBig(true, "LogroFOR3");
                    //Activar logro 30 comandas condicionals
                }
                dayExp += feedback.Item2;   // Sumamos la experiencia de esta comanda a la experiencia del día.

                this.timeCurrentOrder = 0f; // Reiniciamos el tiempo del pedido.
            }
        }
    }