Exemple #1
0
    void Update()
    {
        if (leftHand.activeSelf == false)
        {
            menuItems.SetActive(true);
            raycasterHead.SetActive(true);
        }

        if (rightHand.activeSelf == false)
        {
            mouseControl.LeftUp();
            pinchMouseButtons.IsWaiting = false;
            raycasterHead.SetActive(true);
        }
    }
    void Update()
    {
        if (IsWaiting == false)
        {
            if (useLeftHand == true)
            {
                if (gesture.LeftIsVisible)
                {
                    if (gesture.LeftIsFacingAway == true)
                    {
                        PalmLabel.SetActive(false);
                        if (gesture.LeftIndexPinch == true)
                        {
                            if (wasHolding == false)
                            {
                                Debug.Log("LEFT-CLICK-DOWN");
                                mouseControl.LeftDown();
                                wasHolding = true;
                            }
                        }
                        else
                        {
                            Debug.Log("LEFT-CLICK-UP");
                            mouseControl.LeftUp();
                            wasHolding = false;
                        }
                    }
                    else if (gesture.LeftIsFacingAway == false)
                    {
                        if (wasHolding == true)
                        {
                            Debug.Log("LEFT-CLICK-UP");
                            mouseControl.LeftUp();
                            wasHolding = false;
                        }
                        PalmLabel.SetActive(true);
                        if (gesture.LeftIndexPinch == true)
                        {
                            Debug.Log("RIGHT-CLICK");
                            mouseControl.RightClick();
                            StartCoroutine(DelayNextClick(1.0f));
                        }
                        else if (gesture.LeftPinkyPinch == true)
                        {
                            Debug.Log("MIDDLE-CLICK");
                            mouseControl.MiddleClick();
                            StartCoroutine(DelayNextClick(1.0f));
                        }
                    }
                }
            }
            else
            {
                if (gesture.RightIsVisible)
                {
                    if (gesture.RightIsFacingAway == true)
                    {
                        PalmLabel.SetActive(false);
                        if (gesture.RightIndexPinch == true)
                        {
                            if (wasHolding == false)
                            {
                                Debug.Log("LEFT-CLICK-DOWN");
                                mouseControl.LeftDown();
                                wasHolding = true;
                            }
                        }
                        else
                        {
                            if (wasHolding == true)
                            {
                                Debug.Log("LEFT-CLICK-UP");
                                mouseControl.LeftUp();
                                wasHolding = false;
                            }
                        }
                    }
                    else if (gesture.RightIsFacingAway == false)
                    {
                        if (wasHolding == true)
                        {
                            Debug.Log("LEFT-CLICK-UP");
                            mouseControl.LeftUp();
                            wasHolding = false;
                        }

                        PalmLabel.SetActive(true);
                        if (gesture.RightIndexPinch == true)
                        {
                            Debug.Log("RIGHT-CLICK");
                            mouseControl.RightClick();
                            StartCoroutine(DelayNextClick(1.0f));
                        }
                        else if (gesture.RightPinkyPinch == true)
                        {
                            Debug.Log("MIDDLE-CLICK");
                            mouseControl.MiddleClick();
                            StartCoroutine(DelayNextClick(1.0f));
                        }
                    }
                }
            }
        }
    }