示例#1
0
    private void Update()
    {
        if (delay)
        {
            delay      = false;
            currentID  = -1;
            displaying = false;
            tpc.inShop = false;
            //    tpc.inCutscene = false;
            //    tpc.disableControl = false;
            //    tpc.rb.isKinematic = false;
            //    camF.disableControl = false;
            //    Time.timeScale = 1f;
        }

        if ((animator.GetCurrentAnimatorStateInfo(0).IsName("Prompt Continue") || animator.GetCurrentAnimatorStateInfo(0).IsName("Prompt Collectable")) && input.GetButtonDown("Submit"))
        {
            if (curYestText == YesText.buy)
            {
                if (currentMI.useBlueBerries)
                {
                    berryCount = PlayerPrefs.GetInt("BlueBerries", 0);
                }
                else
                {
                    berryCount = PlayerPrefs.GetInt("Berries", 0);
                }

                if (berryCount < currentMI.price || (currentMI.price == -1 && PlayerPrefs.GetInt("AllBlueBerries", 0) == 0))
                {
                    animator.SetTrigger("tooExpensive");
                    PlaySound(tooExpensiveClip);
                }
                else
                {
                    if (aiLeafs)
                    {
                        aiLeafs.TouchThis();
                    }
                    if (aiBonuses)
                    {
                        aiBonuses.TouchThis();
                    }
                    if (aiMasks)
                    {
                        aiMasks.TouchThis();
                    }

                    if (currentMI.useBlueBerries)
                    {
                        tpc.blueberryCount -= currentMI.price;
                        tpc.blueberryHUD.SetTrigger("bounceText");
                        tpc.blueberryText.text = tpc.blueberryCount.ToString();
                        PlayerPrefs.SetInt("BlueBerries", tpc.blueberryCount);
                    }
                    else
                    {
                        tpc.berryCount -= currentMI.price;
                        tpc.berryHUD.SetTrigger("bounceText");
                        tpc.berryText.text = tpc.berryCount.ToString();
                        PlayerPrefs.SetInt("Berries", tpc.berryCount);
                    }

                    animator.SetBool("boughtIt", true);
                    animator.SetBool("promptOn", false);
                    animator.SetTrigger("nextState");
                    tpc.berryHUD.SetBool("function", false);
                    tpc.blueberryHUD.SetBool("function", false);
                    delay = true;
                    inPromptTrigger[currentID] = false;
                    PlaySound(buyClip);
                }
            }
            if (curYestText == YesText.equip)
            {
                if (aiLeafs)
                {
                    aiLeafs.TouchThis();
                }
                if (aiBonuses)
                {
                    aiBonuses.TouchThis();
                }
                if (aiMasks)
                {
                    aiMasks.TouchThis();
                }

                PlaySound(equipClip);
                _ExitPrompt(currentID);
            }
            if (curYestText == YesText.unequip)
            {
                if (aiLeafs)
                {
                    aiLeafs.UnTouchThis();
                }
                if (aiBonuses)
                {
                    aiBonuses.UnTouchThis();
                }
                if (aiMasks)
                {
                    aiMasks.UntouchThis();
                }

                PlaySound(equipClip);
                _ExitPrompt(currentID);
            }
            if (curYestText == YesText.cont)
            {
                PlaySound(equipClip);
                _ExitPrompt(currentID);
            }
        }

        if (animator.GetCurrentAnimatorStateInfo(0).IsName("Prompt Continue") && input.GetButtonDown("Back"))
        {
            PlaySound(declineClip);
            _ExitPrompt(currentID);
        }
    }