public void Init()
        {
            EffectsScript = GetComponent <ViveSR_Experience_Effects>();
            PortalScript  = GetComponent <ViveSR_Experience_Portal>();
            dartGenerator = PortalScript.dartGeneratorMgr_portal.GetComponent <ViveSR_Experience_IDartGenerator>();

            GameObject attachPointCanvas = ViveSR_Experience.instance.AttachPoint.transform.GetChild(ViveSR_Experience.instance.AttachPointIndex).transform.gameObject;

            LeftHint    = attachPointCanvas.transform.Find("TouchpadCanvas/LeftText").gameObject;
            RightHint   = attachPointCanvas.transform.Find("TouchpadCanvas/RightText").gameObject;
            TriggerHint = attachPointCanvas.transform.Find("TriggerCanvas").gameObject;

            PortalScript.SetPortal(true);
            ViveSR_Experience_ControllerDelegate.triggerDelegate  += HandleTrigger_ThrowableItemUI;
            ViveSR_Experience_ControllerDelegate.touchpadDelegate += HandleTouchpad_ControlPortal;
            ViveSR_Experience_ControllerDelegate.gripDelegate     += HandleGrip_SwitchEffects;

            PortalScript.Init();
        }
Beispiel #2
0
        private void GetPortalScriptsByFindingObject()
        {
            // Find the portal scripts.
            experiencePortalScript = FindObjectOfType <ViveSR_Experience_Portal>();
            portalManager          = FindObjectOfType <ViveSR_PortalMgr>();

            // If both the scripts are found, the portal function could be used in the scene.
            if (experiencePortalScript != null && portalManager != null)
            {
                // If the portal is already on, trigger the portal on event callback.
                if (experiencePortalScript.IsPortalOn)
                {
                    OnPortalOn();
                }

                // Register the portal events.
                experiencePortalScript.portalOnEvent.AddListener(OnPortalOn);
                experiencePortalScript.portalOffEvent.AddListener(OnPortalOff);
            }
        }
 protected override void StartToDo()
 {
     PortalScript     = ViveSR_Experience_Demo.instance.PortalScript;
     StaticMeshScript = ViveSR_Experience_Demo.instance.StaticMeshScript;
     EnableButton(StaticMeshScript.CheckChairExist());
 }
 protected override void StartToDo()
 {
     dartGeneratorMgr     = ViveSR_Experience_Demo.instance.DartGeneratorMgrs[DartGeneratorIndex.ForPortal];
     PortalScript         = ViveSR_Experience_Demo.instance.PortalScript;
     PortalScript.enabled = true;
 }
        public void Init()
        {
            ViveSR_Experience_HintMessage.instance.Init();

            PlayerHandUILaserPointer.CreateLaserPointer();
            PlayerHandUILaserPointer.EnableLaserPointer(false);

            Rotator           = FindObjectOfType <ViveSR_Experience_Rotator>();
            Tutorial          = FindObjectOfType <ViveSR_Experience_Tutorial>();
            StaticMeshScript  = FindObjectOfType <ViveSR_Experience_StaticMesh>();
            CalibrationScript = FindObjectOfType <ViveSR_Experience_Calibration>();
            PortalScript      = FindObjectOfType <ViveSR_Experience_Portal>();

            ButtonScripts[MenuButton.DepthControl]  = FindObjectOfType <ViveSR_Experience_Button_DepthControl>();
            ButtonScripts[MenuButton._3DPreview]    = FindObjectOfType <ViveSR_Experience_Button_3DPreview>();
            ButtonScripts[MenuButton.EnableMesh]    = FindObjectOfType <ViveSR_Experience_Button_EnableMesh>();
            ButtonScripts[MenuButton.Segmentation]  = FindObjectOfType <ViveSR_Experience_Button_Segmentation>();
            ButtonScripts[MenuButton.Portal]        = FindObjectOfType <ViveSR_Experience_Button_Portal>();
            ButtonScripts[MenuButton.Effects]       = FindObjectOfType <ViveSR_Experience_Button_Effects>();
            ButtonScripts[MenuButton.CameraControl] = FindObjectOfType <ViveSR_Experience_Button_CameraControl>();
            ButtonScripts[MenuButton.Calibration]   = FindObjectOfType <ViveSR_Experience_Button_Calibration>();

            SubButtonScripts[SubMenuButton._3DPreview_Save]       = FindObjectOfType <ViveSR_Experience_SubBtn_3DPreview_Save>();
            SubButtonScripts[SubMenuButton._3DPreview_Scan]       = FindObjectOfType <ViveSR_Experience_SubBtn_3DPreview_Scan>();
            SubButtonScripts[SubMenuButton.Calibration_Alignment] = FindObjectOfType <ViveSR_Experience_SubBtn_Calibration_Alignment>();
            SubButtonScripts[SubMenuButton.Calibration_Focus]     = FindObjectOfType <ViveSR_Experience_SubBtn_Calibration_Focus>();
            SubButtonScripts[SubMenuButton.Calibration_Reset]     = FindObjectOfType <ViveSR_Experience_SubBtn_Calibration_Reset>();
            SubButtonScripts[SubMenuButton.EnableMesh_StaticMR]   = FindObjectOfType <ViveSR_Experience_SubBtn_EnableMesh_StaticMR>();
            SubButtonScripts[SubMenuButton.EnableMesh_StaticVR]   = FindObjectOfType <ViveSR_Experience_SubBtn_EnableMesh_StaticVR>();
            SubButtonScripts[SubMenuButton.EnableMesh_Dynamic]    = FindObjectOfType <ViveSR_Experience_SubBtn_EnableMesh_Dynamic>();

            for (int i = 0; i < (int)DartGeneratorIndex.MaxNum; i++)
            {
                DartGeneratorMgrs[(DartGeneratorIndex)i] = _DartGeneratorMgrs[i];
            }

            for (int i = 0; i < (int)MenuButton.MaxNum; i++)
            {
                MenuButton MenuButton = (MenuButton)i;
                ButtonRenderers[MenuButton] = ButtonScripts[MenuButton].GetComponentInChildren <Renderer>();
            }

            ViveSR_Experience.instance.AttachPoint.SetActive(true);
            PortalScript.Init();
            Rotator.Init();


            for (int i = 0; i < Rotator.IncludedBtns.Count; ++i)
            {
                Rotator.IncludedBtns[i].Init_Awake();
                Rotator.IncludedBtns[i].Init_Start();

                if (Rotator.IncludedBtns[i].SubMenu == null)
                {
                    continue;
                }
                for (int j = 0; j < Rotator.IncludedBtns[i].SubMenu.subBtnScripts.Count; ++j)
                {
                    Rotator.IncludedBtns[i].SubMenu.subBtnScripts[j].Init_Awake();
                    Rotator.IncludedBtns[i].SubMenu.subBtnScripts[j].Init_Start();
                }
            }

            Tutorial.Init();
        }