Esempio n. 1
0
 public bool StartChooping()
 {
     if (choppingHolder.HasMovable())
     {
         movableObject movable = choppingHolder.GetMovable();
         currentFood = movable.GetComponent <food>();
         if (currentFood != null && currentFood.GetStatus() == foodStatus.RAW)
         {
             isChooping = true;
             cut.Play();
         }
     }
     return(isChooping);
 }
Esempio n. 2
0
    // Update is called once per frame
    public void Update()
    {
        timer();
        float horizontalMove = Input.GetAxis("Horizontal");
        float verticalMove   = Input.GetAxis("Vertical");

        moveTo = new Vector3(horizontalMove, 0, verticalMove);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Entrega = FindObjectOfType <entrega>();
            int tipo = Entrega.devolver();
            Debug.Log("es: " + tipo);
            grab.Play();
            table currentTable = cercaDetection.Getselected();
            if (currentTable != null)
            {
                holder currentTableHolder = currentTable.GetComponent <holder>();
                if (myPlayerHolder.HasMovable())
                {
                    movableObject movable = myPlayerHolder.GetMovable();
                    Trash         trash   = currentTable.GetComponent <Trash>();
                    entrega       enter   = currentTable.GetComponent <entrega>();
                    if (enter != null)
                    {
                        myPlayerHolder.RemoveMovable();
                        PlateTomato.SetActive(false);
                        PlateCebolla.SetActive(false);
                        PlateMushroom.SetActive(false);
                        PlateBad.SetActive(false);
                        empty.SetActive(true);
                        pot Pot = GetComponent <pot>();
                        //GameObject potObject = Pot.full;
                        //GameObject potObject1 = Pot.empty;
                        //potObject.SetActive(false);
                        //potObject1.SetActive(true);
                        segundos = 0;
                        if (marcador == tipo)
                        {
                            puntos      += 100;
                            puntaje.text = "" + puntos;
                            marcador     = 0;
                            good.Play();
                        }
                        else
                        {
                            puntos      -= 50;
                            puntaje.text = "" + puntos;
                            marcador     = 0;
                            bad.Play();
                        }
                    }

                    if (trash != null)
                    {
                        myPlayerHolder.RemoveMovable();
                        Destroy(movable.gameObject);
                        food Food = movable.GetComponent <food>();
                        myPlayerHolder.RemoveMovable();
                        drop.Play();
                    }
                    else
                    {
                        movableObject tableMovable = currentTableHolder.GetMovable();
                        if (tableMovable != null)
                        {
                            drop.Play();
                            Container tableContainer = tableMovable.GetComponent <Container>();
                            if (tableContainer != null)
                            {
                                food FOOD = movable.GetComponent <food>();
                                if (FOOD != null)
                                {
                                    if (tableContainer.CanAccept(FOOD))
                                    {
                                        pot_number += 1;
                                        myPlayerHolder.RemoveMovable();
                                        tableContainer.recived(FOOD);
                                        objeto.SetActive(false);
                                        drop.Play();
                                    }
                                    if (pot_number == 3)
                                    {
                                        objeto_pot.SetActive(true);
                                        //pot_number = pot_number - 3;
                                        foodType r1 = tableContainer.resultado();
                                        foodType r2 = tableContainer.resultado2();
                                        foodType r3 = tableContainer.resultado3();
                                        if (r3 == T && r2 == T && r1 == T)
                                        {
                                            empty.SetActive(false);
                                            PlateTomato.SetActive(true);
                                            marcador = 1;
                                        }
                                        else if (r3 == O && r2 == O && r1 == O)
                                        {
                                            empty.SetActive(false);
                                            PlateCebolla.SetActive(true);
                                            marcador = 0;
                                        }
                                        else if (r3 == M && r2 == M && r1 == M)
                                        {
                                            empty.SetActive(false);
                                            PlateMushroom.SetActive(true);
                                            marcador = 1;
                                        }
                                        else
                                        {
                                            empty.SetActive(false);
                                            PlateBad.SetActive(true);
                                            marcador = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            currentTableHolder.SetMovable(movable);
                            myPlayerHolder.RemoveMovable();
                        }
                    }
                }
                else
                {
                    if (currentTableHolder.HasMovable())
                    {
                        movableObject movable = currentTableHolder.GetMovable();
                        myPlayerHolder.SetMovable(movable);
                        currentTableHolder.RemoveMovable();
                    }
                    else
                    {
                        NewIngrediente ig = currentTable.GetComponent <NewIngrediente>();
                        if (ig != null)
                        {
                            movableObject movable = ig.GetIngredient();
                            myPlayerHolder.SetMovable(movable);
                        }
                    }
                }
            }
        }

        if (pot_number == 3)
        {
            table  currentTable = cercaDetection.Getselected();
            estufa Estufa       = currentTable.GetComponent <estufa>();
            if (Estufa != null)
            {
                segundos = segundos + 0.01f;
                if (segundos > 4)
                {
                    Alarm.Play();
                    humo.SetActive(true);
                    pot_number -= 3;
                    potBurned.SetActive(true);
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            table currentTable = cercaDetection.Getselected();
            if (currentTable != null)
            {
                chopper currentChopper = currentTable.GetComponent <chopper>();
                if (currentChopper != null)
                {
                    objeto.SetActive(true);
                    IsChopping = currentChopper.StartChooping();
                }
            }
        }
    }