示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (popupManager.ActionKeyBlocked())
        {
            return;
        }

        if (carryingCarrot)
        {
            if (inCarrotPile && Input.GetButtonDown("Action"))
            {
                carryingCarrot = false;
                mouthCarrot.SetActive(false);
                scoreCounter.AddToScore(1);
                carrotPile.AddCarrot();
                mirror.MirrorActions();

                if (!tutorial3WasShown)
                {
                    PopupManager.instance.ShowPopupTutorial3(); tutorial3WasShown = true;
                }
            }
        }
        else
        {
            Carrot nearestCarrot = fieldManager.GetNearestFullGrownCarrot(transform.position);
            if (nearestCarrot != null &&
                Vector3.Distance(transform.position, nearestCarrot.transform.position) < pickDistance)
            {
                if (Input.GetButtonDown("Action"))
                {
                    Destroy(nearestCarrot.gameObject);
                    carryingCarrot = true;
                    mouthCarrot.SetActive(true);

                    if (!tutorial2WasShown)
                    {
                        PopupManager.instance.ShowPopupTutorial2(); tutorial2WasShown = true;
                    }
                }
            }
        }
    }