Пример #1
0
        public Vector2 GetAxis(WVR_InputId _id)
        {
            if (!connected)
            {
                return(Vector2.zero);
            }

            if (_id != WVR_InputId.WVR_InputId_Alias1_Touchpad && _id != WVR_InputId.WVR_InputId_Alias1_Trigger)
            {
                Log.e(LOG_TAG, "GetAxis, button " + _id + " does NOT have axis!");
                return(Vector2.zero);
            }

            #if UNITY_EDITOR || UNITY_STANDALONE
            if (isEditorMode)
            {
                var system = WaveVR_PoseSimulator.Instance;
                axis = system.GetAxis(DeviceType, _id);
            }
            else
            #endif
            {
                axis = Interop.WVR_GetInputAnalogAxis(DeviceType, _id);
            }

            //Log.d (LOG_TAG, "GetAxis: {" + axis.x + ", " + axis.y + "}");
            return(new Vector2(axis.x, axis.y));
        }
        public Vector2 GetAxis(WVR_InputId _id)
        {
            if (!this._connected)
            {
                return(Vector2.zero);
            }

            bool _isTouchId = false;

            for (int _t = 0; _t < touchIds.Length; _t++)
            {
                if (_id == touchIds [_t])
                {
                    _isTouchId = true;
                    break;
                }
            }

            if (!_isTouchId)
            {
                Log.e(LOG_TAG, "GetAxis, button " + _id + " does NOT have axis!");
                return(Vector2.zero);
            }

            axis = Interop.WVR_GetInputAnalogAxis(DeviceType, _id);

            //Log.d (LOG_TAG, "GetAxis: {" + axis.x + ", " + axis.y + "}");
            return(new Vector2(axis.x, axis.y));
        }
Пример #3
0
        public Vector2 GetAxis(WVR_InputId _id)
        {
            if (_id != WVR_InputId.WVR_InputId_Alias1_Touchpad && _id != WVR_InputId.WVR_InputId_Alias1_Trigger)
            {
                Log.e(LOG_TAG, "GetAxis, button " + _id + " does NOT have axis!");
                return(Vector2.zero);
            }

            bool           _connected = false;
            WVR_DeviceType _type      = this.DeviceType;

            #if UNITY_EDITOR || UNITY_STANDALONE
            if (isEditorMode)
            {
                _connected = WaveVR_Controller.Input(this.DeviceType).connected;
                _type      = WaveVR_Controller.Input(this.DeviceType).DeviceType;
            }
            else
            #endif
            {
                if (WaveVR.Instance != null)
                {
                    WaveVR.Device _device = WaveVR.Instance.getDeviceByType(this.DeviceType);
                    _connected = _device.connected;
                    _type      = _device.type;
                }
            }

            #if UNITY_EDITOR || UNITY_STANDALONE
            if (isEditorMode)
            {
                if (!WaveVR.Instance.isSimulatorOn)
                {
                    var system = WaveVR_PoseSimulator.Instance;
                    axis = system.GetAxis(_type, WVR_InputId.WVR_InputId_Alias1_Trigger);
                }
                else
                {
                    if (_connected)
                    {
                        axis = WaveVR_Utils.WVR_GetInputAnalogAxis_S((int)_type, (int)_id);
                    }
                }
            }
            else
            #endif
            {
                if (_connected)
                {
                    axis = Interop.WVR_GetInputAnalogAxis(_type, _id);
                }
            }

            //Log.d (LOG_TAG, "GetAxis: {" + axis.x + ", " + axis.y + "}");
            return(new Vector2(axis.x, axis.y));
        }
        public Vector2 GetAxis(WVR_InputId btn)
        {
            // No axis if disconnected or untouched.
            if (!_connected || !GetTouch(btn))
            {
                return(Vector2.zero);
            }

            axis = Interop.WVR_GetInputAnalogAxis(DeviceType, btn);
            return(new Vector2(axis.x, axis.y));
        }
        public Vector2 GetAxis(WVR_InputId _id)
        {
            if (!this._connected)
            {
                return(Vector2.zero);
            }

            bool _isTouchId = false;

            for (int _t = 0; _t < touchIds.Length; _t++)
            {
                if (_id == touchIds [_t])
                {
                    _isTouchId = true;
                    break;
                }
            }

            if (!_isTouchId)
            {
                Log.e(LOG_TAG, "GetAxis, button " + _id + " does NOT have axis!");
                return(Vector2.zero);
            }

            #if UNITY_EDITOR || UNITY_STANDALONE
            if (isEditorMode)
            {
                if (!WaveVR.Instance.isSimulatorOn)
                {
                    var system = WaveVR_PoseSimulator.Instance;
                    axis = system.GetAxis(DeviceType, _id);
                }
                else
                {
                    axis = WaveVR_Utils.WVR_GetInputAnalogAxis_S((int)DeviceType, (int)_id);
                }
            }
            else
            #endif
            {
                axis = Interop.WVR_GetInputAnalogAxis(DeviceType, _id);
            }

            //Log.d (LOG_TAG, "GetAxis: {" + axis.x + ", " + axis.y + "}");
            return(new Vector2(axis.x, axis.y));
        }