Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (sr_pController.currentlyOnStove != null)
        {
            chopDisplay.fillAmount = fillCurrent / fillMax;
        }

        //--------------------------------------------------
        // COOK BUTTONS
        //--------------------------------------------------

        if (XCI.GetButtonDown(XboxButton.A, controller))
        {
            if (sr_pController.currentlyOnStove)
            {
                Foods temp = sr_pController.currentlyOnStove.GetComponent <Foods>();
                if (temp.isReady)
                {
                    ToggleDone(true);
                }
                else if (!temp.isReady)
                {
                    if ((int)temp.thisFoodType == 0)
                    {
                        temp.SetFoodType(1);
                    }
                    if ((int)temp.thisFoodType == 1)
                    {
                        temp.getChopped();
                        fillCurrent += 1f;
                    }
                }
            }

            else
            {
                SetFood(foodA, 1);
            }
        }

        if (XCI.GetButtonDown(XboxButton.B, controller))
        {
            if (sr_pController.currentlyOnStove)
            {
                Foods temp = sr_pController.currentlyOnStove.GetComponent <Foods>();
                if (!temp.isReady)
                {
                    if ((int)temp.thisFoodType == 0)
                    {
                        temp.SetFoodType(2);
                    }
                    if ((int)temp.thisFoodType == 2)
                    {
                        temp.getChopped();
                        fillCurrent += 1;
                    }
                }
                else if (temp.isReady)
                {
                    ToggleDone(true);
                }
            }

            else
            {
                SetFood(foodB, 2);
            }
        }

        if (XCI.GetButtonDown(XboxButton.X, controller))
        {
            if (sr_pController.currentlyOnStove)
            {
                Foods temp = sr_pController.currentlyOnStove.GetComponent <Foods>();
                if (!temp.isReady)
                {
                    //chopDisplay.fillAmount = sr_food.chopProgress / sr_food.chopFinish;
                    if ((int)temp.thisFoodType == 0)
                    {
                        temp.SetFoodType(3);
                    }
                    if ((int)temp.thisFoodType == 3)
                    {
                        temp.getChopped();
                        fillCurrent += 1;
                    }
                }
                else if (temp.isReady)
                {
                    ToggleDone(true);
                }
            }

            else
            {
                SetFood(foodX, 3);
            }
        }

        if (XCI.GetButtonDown(XboxButton.Y, controller))
        {
            if (sr_pController.currentlyOnStove)
            {
                Foods temp = sr_pController.currentlyOnStove.GetComponent <Foods>();
                if (!temp.isReady)
                {
                    //chopDisplay.fillAmount = sr_food.chopProgress / sr_food.chopFinish;
                    if ((int)temp.thisFoodType == 0)
                    {
                        temp.SetFoodType(4);
                    }
                    if ((int)temp.thisFoodType == 4)
                    {
                        temp.getChopped();
                        fillCurrent += 1;
                    }
                }
                else if (temp.isReady)
                {
                    ToggleDone(true);
                }
            }

            else
            {
                SetFood(foodY, 4);
            }
        }
    }