Пример #1
0
    void Update()
    {
        if (canPickUp && !isHolding)
        {
            PickUp();
        }
        else if (!canFeed && !canAddIngredient && !canPutDoughHoven && !canSell && isHolding)
        {
            PutDown();
        }
        else if (canFeed)
        {
            Feeding();
        }
        else if (canOrder && Input.GetKeyDown(KeyCode.E) && money > 0)
        {
            Dispenser.GetComponent <Dispenser>().Dispense();
        }
        else if (canCollect)
        {
            CollectingLevain();
        }
        else if (canCollectDough)
        {
            CollectingDough();
        }
        else if (canAddIngredient)
        {
            AddIngredient();
        }
        else if (canPutDoughHoven)
        {
            PutDoughHoven();
        }
        else if (canCollectBread)
        {
            CollectingBread();
        }
        else if (canSell)
        {
            SellBread();
        }

        //LEVAIN LIFE POINTS
        if (levain.currentLifePoint <= 0)
        {
            GameOver();
        }

        //TIMER
        if (currentTimer <= maxTimer)
        {
            currentTimer += Time.deltaTime;
            Hud.UpdateTimer(currentTimer / maxTimer);
        }
        else
        {
            GameWin();
        }

        //TUTORIAL
        if (!isPourring && !isGameOver)
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                Hud.ShowTutorial();
            }
            if (Input.GetKeyUp(KeyCode.F))
            {
                Hud.HideTutorial();
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Hud.ShowPauseMenu();
        }
    }