コード例 #1
0
        void WaveVR_Setup()
        {
#if CUSTOM_WAVEVR_SDK
            AssetsReference assetsReference = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);
            if (assetsReference != null)
            {
                //WaveVR Root GameObject
                GameObject waveSDK = new GameObject("WaveVR_SETUP");

                //Create WaveVR SDK for Camera rendering and Head Gear.
                Instantiate(assetsReference.GetWaveVRSDK, waveSDK.transform);

                //Create WaveVR Button to receive any button event...
                Instantiate(assetsReference.GetWaveVRButtons, waveSDK.transform);

                //Create Controller Loader for Left and Right Controller.
                GameObject controllerLeft  = Instantiate(assetsReference.GetWaveVRControllerLoader, waveSDK.transform);
                GameObject controllerRight = Instantiate(assetsReference.GetWaveVRControllerLoader, waveSDK.transform);
                controllerLeft.GetComponent <WaveVR_ControllerLoader>().WhichHand  = WaveVR_ControllerLoader.ControllerHand.Non_Dominant;
                controllerRight.GetComponent <WaveVR_ControllerLoader>().WhichHand = WaveVR_ControllerLoader.ControllerHand.Dominant;

                //Create Input Module Manager
                Instantiate(assetsReference.GetWaveVRInputModule, waveSDK.transform);
            }
#endif
        }
コード例 #2
0
        private void SpawnControllerModel()
        {
            AssetsReference assetsReference  = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);
            ControllerModel _controllerModel = assetsReference.GetControllerMode(deviceType, HandType);

            if (_controllerModel != null)
            {
                controllerModel = (ControllerModel)Instantiate(_controllerModel);
                controllerModel.transform.SetParent(this.transform);
                controllerModel.transform.ResetTransform();
            }
        }
コード例 #3
0
        void XR_SetUp()
        {
            AssetsReference assetsReference = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);

            if (assetsReference != null)
            {
                if (m_XR_SDK_GameObject == null)
                {
                    m_XR_SDK_GameObject = (GameObject)Instantiate(assetsReference.XR_Manager, this.transform);
                }

                XRManager = m_XR_SDK_GameObject.GetComponent <XR_Manager>();
                m_XR_SDK_GameObject.SetActive(true);
            }
        }
コード例 #4
0
        private void Awake()
        {
            CreateInstance();

            if (m_XR_SDK_GameObject != null)
            {
                m_XR_SDK_GameObject.SetActive(false);
            }

            if (showCanvasDebug)
            {
                AssetsReference assetsReference = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);
                GameObject      canvasDebug     = Instantiate(assetsReference.canvasDebugger);
                canvasDebug.transform.SetParent(this.transform);
            }
        }
コード例 #5
0
        public void OnGUI()
        {
            if (assetsHolder == null)
            {
                assetsHolder = Resources.Load <BuildSettingAssetsHolder>(ConstantVar.ResourcesPath.BUILD_SETTINGS);
            }
            if (assetsReference == null)
            {
                assetsReference = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);
            }

            EditorGUILayout.Space();
            SDK_GUI();
            EditorGUILayout.Space();
            BuildGUI();
        }
コード例 #6
0
        private void OnEnable()
        {
            AssetsReference assetsReference = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);

            if (assetsReference != null)
            {
                currentSDK = assetsReference.SDK_Selected;
                if (m_inputManager == null)
                {
                    m_inputManager = new InputManager();
                }

                switch (currentSDK)
                {
                case XR_Enum.SDKType.None: NonVR_SetUp(); break;

                case XR_Enum.SDKType.XR: XR_SetUp(); break;

                case XR_Enum.SDKType.WaveVR: WaveVR_Setup(); break;
                }
            }
        }
コード例 #7
0
        static void OnCheck()
        {
            EditorApplication.update -= OnCheck;

            //Check if WaveVR SDK plugin exist
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();
            var types      = assemblies.SelectMany(a => a.GetTypes()).ToList();

#if UNITY_ANDROID
            bool hasWaveVRSDK = types.Any(t => t.FullName == "WaveVR_Render");
#endif
            bool hasLeanTween     = types.Any(t => t.FullName == "LeanTween");
            bool hasScreenFactory = types.Any(t => t.FullName == "ScreenBase");

#if UNITY_ANDROID
            string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);
#elif UNITY_IOS
            string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS);
#elif UNITY_PS4
            string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.PS4);
#elif UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
            string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
#endif

            string newSymbols = "";

            foreach (var define in symbols.Split(';'))
            {
#if UNITY_ANDROID
                if (define == WaveVRDefine)
                {
                    if (hasWaveVRSDK == false)
                    {
                        continue;
                    }
                    hasWaveVRSDK = false;
                }
#endif

                if (define == LeanTweenDefine)
                {
                    if (hasLeanTween == false)
                    {
                        continue;
                    }
                    hasLeanTween = false;
                }

                if (define == ScreenFactoryDefine)
                {
                    if (hasScreenFactory == false)
                    {
                        continue;
                    }
                    hasScreenFactory = false;
                }

                AppendDefine(ref newSymbols, define);
            }

#if UNITY_ANDROID
            if (hasWaveVRSDK)
            {
                AssetsReference assetsReference = Resources.Load <AssetsReference>(ConstantVar.ResourcesPath.ASSETS_REFERENCE);
                if (assetsReference != null && assetsReference.SDK_Selected == XRCustomFramework.XR_Enum.SDKType.WaveVR)
                {
                    AppendDefine(ref newSymbols, WaveVRDefine);
                    Debug.LogFormat("Add scripting define symbol {0} for Android platform", WaveVRDefine);
                }
            }
#endif

            if (hasLeanTween)
            {
                AppendDefine(ref newSymbols, LeanTweenDefine);
                Debug.LogFormat("Add scripting define symbol {0} for All platform", LeanTweenDefine);
            }

            if (hasScreenFactory)
            {
                AppendDefine(ref newSymbols, ScreenFactoryDefine);
                Debug.LogFormat("Add scripting define symbol {0} for All platform", ScreenFactoryDefine);
            }

            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, newSymbols);
        }