Ejemplo n.º 1
0
    void Update()
    {
        //Plays the easter egg sound
        if (GestureInputManager.CurrentInput == InputAction.TrippleFingerDoubleTap || GestureInputManager.CurrentInput == InputAction.TrippleFingerPressed)
        {
            if (!source.isPlaying && source.isActiveAndEnabled)
            {
                easterEgg.onClick.Invoke();
            }
        }

        //Selects and plays the button name
        else if (GestureInputManager.CurrentInput == InputAction.Click)
        {
            try
            {
                btn.Select();
                aSG = btn.GetComponent <AudioSG>();
                aSG.HoverSound();
            }

            catch
            {
                Debug.Log("no btn selected");
            }
        }

        //Access the selected buttons on click method
        else if (GestureInputManager.CurrentInput == InputAction.DoubleClick)
        {
            try
            {
                sB  = FindObjectOfType <SelectButton>();
                btn = sB.GetButton();

                if (btn != null)
                {
                    btn.onClick.Invoke();
                    EventSystem.current.SetSelectedGameObject(null);
                    btn = null;
                }
            }

            catch
            {
                Debug.Log("Error");
            }
        }
    }
    public void Gestures(string type)
    {
        //Selects the button when clicked
        if (type != "Click" && type != "back")
        {
            btn      = sB.GetButton();
            selected = false;
        }


        if (btn != null && !selected)
        {
            selected = true;

            //Access button onClick on double click
            if (type == "DoubleClick")
            {
                EventSystem.current.SetSelectedGameObject(btn.gameObject);
                btn.onClick.Invoke();
            }
        }
    }