Example #1
0
        public void ProcessInput(ActionMapInput input, ConsumeControlDelegate consumeControl)
        {
            var radialMenuInput = (RadialMenuInput)input;

            if (radialMenuInput == null || m_MenuHideFlags != 0)
            {
                this.ClearFeedbackRequests();
                return;
            }

            var inputDirection = radialMenuInput.navigate.vector2;

            if (inputDirection.magnitude > k_ActivationThreshold)
            {
                // Composite controls need to be consumed separately
                consumeControl(radialMenuInput.navigateX);
                consumeControl(radialMenuInput.navigateY);
                m_RadialMenuUI.buttonInputDirection = inputDirection;
            }
            else
            {
                m_RadialMenuUI.buttonInputDirection = Vector2.zero;
            }

            var selectControl = radialMenuInput.selectItem;

            m_RadialMenuUI.pressedDown = selectControl.wasJustPressed;
            if (m_RadialMenuUI.pressedDown)
            {
                consumeControl(selectControl);
            }

            if (selectControl.wasJustReleased)
            {
                this.Pulse(node, m_ReleasePulse);

                m_RadialMenuUI.SelectionOccurred();

                if (itemWasSelected != null)
                {
                    itemWasSelected(rayOrigin);
                }

                consumeControl(selectControl);
            }
        }
Example #2
0
        public void ProcessInput(ActionMapInput input, ConsumeControlDelegate consumeControl)
        {
            var radialMenuInput = (RadialMenuInput)input;

            if (radialMenuInput == null || !visible)
            {
                return;
            }

            var inputDirection = radialMenuInput.navigate.vector2;

            m_RadialMenuUI.buttonInputDirection = inputDirection;

            if (inputDirection != Vector2.zero)
            {
                // Composite controls need to be consumed separately
                consumeControl(radialMenuInput.navigateX);
                consumeControl(radialMenuInput.navigateY);
            }

            m_RadialMenuUI.pressedDown = radialMenuInput.selectItem.wasJustPressed;
            if (m_RadialMenuUI.pressedDown)
            {
                consumeControl(radialMenuInput.selectItem);
            }

            if (radialMenuInput.selectItem.wasJustReleased)
            {
                m_RadialMenuUI.SelectionOccurred();

                if (itemWasSelected != null)
                {
                    itemWasSelected(rayOrigin);
                }

                consumeControl(radialMenuInput.selectItem);
            }
        }