Example #1
0
        private void setMode(UIColorMode colorMode)
        {
            this.mode = colorMode;
            switch (this.mode)
            {
            case UIColorMode.Palette:
                this.colorPalette.gameObject.SetActive(true);
                this.colorPicker.gameObject.SetActive(false);
                this.scrollBar.gameObject.SetActive(true);
                break;

            case UIColorMode.Picker:
                this.colorPalette.gameObject.SetActive(false);
                this.colorPicker.gameObject.SetActive(true);
                this.scrollBar.gameObject.SetActive(false);
                break;

            default:
                this.colorPalette.gameObject.SetActive(false);
                this.colorPicker.gameObject.SetActive(false);
                this.scrollBar.gameObject.SetActive(false);
                break;
            }
        }
Example #2
0
    private void Awake()
    {
        uiColorMode   = _uiColorMode;
        whitePoint    = _whitePoint;
        colorGradient = _colorGradient;

        head = Hands.Provider.transform;

        var pinchGestures = FindObjectsOfType <PinchGesture>();

        if (pinchGestures.Length > 1)
        {
            foreach (var item in pinchGestures)
            {
                if (item.whichHand == Chirality.Left)
                {
                    pinchLeft = item;
                }
                else if (item.whichHand == Chirality.Right)
                {
                    pinchRight = item;
                }
                else
                {
                    Warn("Both left and right PinchGestures are required in the scene", this);
                }
            }
        }

        var interactionHands = FindObjectsOfType <InteractionHand>();

        if (interactionHands.Length > 1)
        {
            foreach (var item in interactionHands)
            {
                if (item.isLeft)
                {
                    handLeft = item;
                }
                else
                {
                    handRight = item;
                }
            }
        }
        else
        {
            Warn("Both left and right InteractionHands are required in the scene", this);
        }

        var raycasts = FindObjectsOfType <HandRaycast>();

        if (raycasts.Length > 1)
        {
            foreach (var item in raycasts)
            {
                if (item.whichHand == Chirality.Left)
                {
                    rayLeft = item;
                }
                else if (item.whichHand == Chirality.Right)
                {
                    rayRight = item;
                }
                else
                {
                    Warn("Couldn't find both left and right HandRaycasts in the scene", this);
                }
            }
        }

        prevPosR = handRight.leapHand.GetIndex().TipPosition.ToVector3();
        prevPosL = handLeft.leapHand.GetIndex().TipPosition.ToVector3();

        prevHeadRot = head.rotation;
    }