Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (player == null)
        {
            player = GameObject.FindWithTag("Player");
            return;
        }
        if (Input_scr.OnUIForwardPressed() && gameover == true)
        {
            SceneManager.LoadScene("Level");

            Camera_scr.timeScale = 1;
            Time.timeScale       = 1;
        }

        if (txtGame.activeSelf)
        {
            txtGame.transform.localPosition = Vector3.Lerp(txtGame.transform.localPosition, Vector3.zero, 0.1f);
        }
        if (txtOver.activeSelf)
        {
            txtOver.transform.localPosition = Vector3.Lerp(txtOver.transform.localPosition, Vector3.zero, 0.1f);
        }
        if (txtNext.activeSelf)
        {
            txtNext.GetComponent <RectTransform>().anchoredPosition = Vector3.Lerp(txtNext.GetComponent <RectTransform>().anchoredPosition, Vector3.zero, 0.1f);
        }
    }
Example #2
0
    void Update()
    {
        if (Input_scr.OnUIForwardPressed())
        {
            StartCoroutine("MenuSelection");
        }

        if (menuPos != menuPosBuffer)
        {
            menuPosBuffer = menuPos;

            for (int i = 0; i < menuText.Length; i++)
            {
                menuText[i].GetComponent <Text>().color = Color.white;
            }
            menuText[menuPos].GetComponent <Text>().color = Color.black;
            selectorTargetPos  = new Vector3(0, selectorStartPos.y + menuPos * -35, 0);
            selectorTargetSize = new Vector2(menuText[menuPos].GetComponent <RectTransform>().sizeDelta.x, 35);

            GetComponent <AudioSource>().clip = navClip;
            GetComponent <AudioSource>().Play();
        }
        selector.transform.localPosition = Vector3.Lerp(selector.transform.localPosition, selectorTargetPos, 0.3f);
        selector.GetComponent <RectTransform>().sizeDelta = Vector2.Lerp(selector.GetComponent <RectTransform>().sizeDelta, selectorTargetSize, 10 * Time.deltaTime);

        if (menuPos < menuText.Length - 1 && Input_scr.OnUIDownPressed())
        {
            menuPos++;
        }
        if (menuPos > 0 && Input_scr.OnUIUpPressed())
        {
            menuPos--;
        }

        // Visual Juice
        if (timer < 0)
        {
            selector.GetComponent <RectTransform>().sizeDelta *= 1.2f;
            timer = 0.5f;
        }
        timer -= Time.deltaTime;
    }