Example #1
0
        void Update()
        {
            Vector2 touchPosition;

            if (RxController.GetTouchPadPoint(out touchPosition))
            {
                m_TouchPadPointer.localPosition = new Vector3(touchPosition.x, touchPosition.y, 0);
            }
            else
            {
                m_TouchPadPointer.localPosition = Vector3.zero;
            }

            m_TP_Up.SetActive(CheckTouchPadButton(TouchPadButtonDirection.Up));
            m_TP_Bottom.SetActive(CheckTouchPadButton(TouchPadButtonDirection.Bottom));
            m_TP_Left.SetActive(CheckTouchPadButton(TouchPadButtonDirection.Left));
            m_TP_Right.SetActive(CheckTouchPadButton(TouchPadButtonDirection.Right));
            m_TP_Center.SetActive(CheckTouchPadButton(TouchPadButtonDirection.Center));

            m_AppButton.SetActive(RxController.IsButton(ControllerButtonCode.App));
            m_HomeButton.SetActive(RxController.IsButton(ControllerButtonCode.Home));


            if (m_BatteryUI)
            {
                m_BatteryUI.text = string.Format("Battery:{0}\r\nVoltage:{1}", this.RxController.Battery, RxController.BatteryVoltage);
            }
        }
Example #2
0
        private bool CheckTouchPadButton(TouchPadButtonDirection direction)
        {
            TouchPadButtonDirection _direction = default(TouchPadButtonDirection);

            if (RxController.IsButton(ControllerButtonCode.TouchPadButton) && RxController.GetTouchPadPoint(out _direction))
            {
                return(direction == _direction);
            }
            else
            {
                return(false);
            }
        }