Пример #1
0
    // Update is called once per frame
    void Update()
    {
        wStates.Update();
        sStates.Update();

        if (wIgnore && wStates.Released())
        {
            wIgnore = false;
        }

        if (sIngore && sStates.Released())
        {
            sIngore = false;
        }

        if (!wIgnore)
        {
            if (wStates.IsDown())
            {
                wStates.StartTime();
            }

            if (wStates.IsLastFrameRepeat() && wStates.IsRepeat() && wStates.TimeUp())
            {
                if (wDownCoroutine != null)
                {
                    StopCoroutine(wDownCoroutine);
                    wDownCoroutine = null;
                }
                if (wUpCoroutine == null)
                {
                    wUpCoroutine = StartCoroutine(MoveBar(wBar, 1));
                }
            }
            else if (wStates.IsUp())
            {
                if (wStates.TimeUp())
                {
                    if (wUpCoroutine != null)
                    {
                        StopCoroutine(wUpCoroutine);
                        wUpCoroutine = null;
                    }
                    if (wDownCoroutine == null)
                    {
                        wDownCoroutine = StartCoroutine(MoveBar(wBar, 0));
                        wBarFinished   = false;
                    }
                }
                else
                {
                    if (selected != 4)
                    {
                        ++selected;
                    }
                    else
                    {
                        selected = 0;
                    }

                    SetSelectedGO(buttons[selected]);
                }
            }
        }

        if (!sIngore)
        {
            if (sStates.IsDown())
            {
                sStates.StartTime();
            }

            if (sStates.IsLastFrameRepeat() && sStates.IsRepeat() && sStates.TimeUp())
            {
                if (sDownCoroutine != null)
                {
                    StopCoroutine(sDownCoroutine);
                    sDownCoroutine = null;
                }
                if (sUpCoroutine == null)
                {
                    sUpCoroutine = StartCoroutine(MoveBar(sBar, 1));
                }
            }
            else if (sStates.IsUp())
            {
                if (sStates.TimeUp())
                {
                    if (sUpCoroutine != null)
                    {
                        StopCoroutine(sUpCoroutine);
                        sUpCoroutine = null;
                    }
                    if (sDownCoroutine == null)
                    {
                        sDownCoroutine = StartCoroutine(MoveBar(sBar, 0));
                        sBarFinished   = false;
                    }
                }
                else
                {
                    if (selected != 0)
                    {
                        --selected;
                    }
                    else
                    {
                        selected = 4;
                    }
                    SetSelectedGO(buttons[selected]);
                }
            }
        }


        if (wBarFinished && sBarFinished)
        {
            wBarFinished = false;
            sBarFinished = false;
            sBar.material.SetFloat("_Fill", 0);
            wBar.material.SetFloat("_Fill", 0);

            sIngore = true;
            wIgnore = true;

            switch (selected)
            {
            case 0:     // Github
            {
                Application.OpenURL("https://github.com/Los-Panas/MathsMare-GDSG-Intrinsic-Game-Jam");
                break;
            }

            case 1:     // Settings
            {
                UIButtons_Functions.instance.SettingsButton();
                break;
            }

            case 2:     // Play
            {
                UIButtons_Functions.instance.PlayButton();
                break;
            }

            case 3:     // Credits
            {
                UIButtons_Functions.instance.CreditsButton();
                break;
            }

            case 4:     // ItchIO
            {
                Application.OpenURL("https://victorgg-11.itch.io/mathsmare");
                break;
            }
            }
        }
    }