public override bool ShouldActivateModule()
        {
            if (!base.ShouldActivateModule())
            {
                return(false);
            }

            var shouldActivate = m_ForceModuleActive;

            InputManager.GetButtonDown(m_SubmitButton);
            shouldActivate |= InputManager.GetButtonDown(m_CancelButton);
            shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_HorizontalAxis), 0.0f);
            shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_HorizontalAxis_2), 0.0f);
            shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_VerticalAxis), 0.0f);
            shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_VerticalAxis_2), 0.0f);
            shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f;
            shouldActivate |= InputManager.GetMouseButtonDown(0);


            for (int i = 0; i < InputManager.touchCount; ++i)
            {
                Touch input = InputManager.GetTouch(i);

                shouldActivate |= input.phase == TouchPhase.Began ||
                                  input.phase == TouchPhase.Moved ||
                                  input.phase == TouchPhase.Stationary;
            }
            return(shouldActivate);
        }
Esempio n. 2
0
        private bool ProcessTouchEvents()
        {
            for (int i = 0; i < InputManager.touchCount; ++i)
            {
                Touch touch = InputManager.GetTouch(i);

                if (touch.type == TouchType.Indirect)
                {
                    continue;
                }

                bool released;
                bool pressed;
                var  pointer = GetTouchPointerEventData(touch, out pressed, out released);

                ProcessTouchPress(pointer, pressed, released);

                if (!released)
                {
                    ProcessMove(pointer);
                    ProcessDrag(pointer);
                }
                else
                {
                    RemovePointerData(pointer);
                }
            }
            return(InputManager.touchCount > 0);
        }
        private bool ProcessTouchEvents()
        {
            for (int i = 0; i < InputManager.touchCount; ++i)
            {
                Touch input = InputManager.GetTouch(i);

                bool released;
                bool pressed;
                var  pointer = GetTouchPointerEventData(input, out pressed, out released);

                ProcessTouchPress(pointer, pressed, released);

                if (!released)
                {
                    ProcessMove(pointer);
                    ProcessDrag(pointer);
                }
                else
                {
                    RemovePointerData(pointer);
                }
            }
            return(InputManager.touchCount > 0);
        }