Example #1
0
        public override void OnActivated()
        {
            if (m_prevXREnabled = XRSettings.enabled)
            {
                XRSettings.enabled = false;
            }

            m_resetDevices      = true;
            hasControlFocus     = true;
            selectedDeviceIndex = VRModule.INVALID_DEVICE_INDEX;

            // Simulator instructions GUI
            m_guiHandle = VRModule.Instance.gameObject.GetComponent <IMGUIHandle>();
            if (m_guiHandle == null)
            {
                m_guiHandle           = VRModule.Instance.gameObject.AddComponent <IMGUIHandle>();
                m_guiHandle.simulator = this;
            }

            m_prevStates = new IVRModuleDeviceState[SIMULATOR_MAX_DEVICE_COUNT];
            m_currStates = new IVRModuleDeviceStateRW[SIMULATOR_MAX_DEVICE_COUNT];
            EnsureDeviceStateLength(SIMULATOR_MAX_DEVICE_COUNT);
            for (uint i = 0u; i < SIMULATOR_MAX_DEVICE_COUNT; ++i)
            {
                EnsureValidDeviceState(i, out m_prevStates[i], out m_currStates[i]);
            }

            if (onActivated != null)
            {
                onActivated();
            }
        }
Example #2
0
        public override void OnDeactivated()
        {
            if (m_guiHandle != null)
            {
                m_guiHandle.simulator = null;
                UnityEngine.Object.Destroy(m_guiHandle);
                m_guiHandle = null;
            }

            UpdateMainCamTracking();

            XRSettings.enabled = m_prevXREnabled;

            if (onDeactivated != null)
            {
                onDeactivated();
            }
        }
        public override void OnActivated()
        {
            if (m_prevXREnabled = XRSettings.enabled)
            {
                XRSettings.enabled = false;
            }

            m_resetDevices      = true;
            hasControlFocus     = true;
            selectedDeviceIndex = VRModule.INVALID_DEVICE_INDEX;

            // Simulator instructions GUI
            m_guiHandle = VRModule.Instance.gameObject.GetComponent <IMGUIHandle>();
            if (m_guiHandle == null)
            {
                m_guiHandle           = VRModule.Instance.gameObject.AddComponent <IMGUIHandle>();
                m_guiHandle.simulator = this;
            }

            if (onActivated != null)
            {
                onActivated();
            }
        }