Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        GvrBetaSeeThroughCameraMode camMode   = GvrBetaSeeThroughCameraMode.RawImage;
        GvrBetaSeeThroughSceneType  sceneType = GvrBetaSeeThroughSceneType.Augmented;

        GvrBetaHeadset.SetSeeThroughConfig(camMode, sceneType);
    }
        private void CycleSeeThroughModes()
        {
            if (!GvrBetaSettings.IsFeatureEnabled(GvrBetaFeature.SeeThrough))
            {
                return;
            }

            GvrBetaSeeThroughCameraMode camMode   = GvrBetaHeadset.CameraMode;
            GvrBetaSeeThroughSceneType  sceneType = GvrBetaSeeThroughSceneType.Augmented;

            switch (camMode)
            {
            case GvrBetaSeeThroughCameraMode.Disabled:
                camMode = GvrBetaSeeThroughCameraMode.RawImage;
                break;

            case GvrBetaSeeThroughCameraMode.RawImage:
                camMode = GvrBetaSeeThroughCameraMode.ToneMap;
                break;

            case GvrBetaSeeThroughCameraMode.ToneMap:
                // When see-through is disabled, use scene type Virtual to restore headpose
                // offset to 0.
                sceneType = GvrBetaSeeThroughSceneType.Virtual;
                camMode   = GvrBetaSeeThroughCameraMode.Disabled;
                break;
            }

            GvrBetaHeadset.SetSeeThroughConfig(camMode, sceneType);

            statusText.text = "Mode: " + camMode;

            bool seethruEnabled = camMode != GvrBetaSeeThroughCameraMode.Disabled;

            foreach (var go in hideDuringSeeThrough)
            {
                go.SetActive(!seethruEnabled);
            }
        }
 private void OnDestroy()
 {
     // Disable see-through when this scene ends.
     GvrBetaHeadset.SetSeeThroughConfig(GvrBetaSeeThroughCameraMode.Disabled,
                                        GvrBetaSeeThroughSceneType.Virtual);
 }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (playVideo.startPlaying && !playVideo.videoPlayer.isPlaying && videoPlay)
        {
            videoPlay = false;
            playVideo.videoPlayer.enabled = false;
            playVideo.videoCanvas.SetActive(false);
            videoNum++;
            if (videoNum != videoFiles.Capacity)
            {
                playVideo.fileName = videoFiles[videoNum];
            }
            audioPlay = false;
            //Debug.Log("Video hidden");
        }

        if (!videoPlay && !audioPlay && !narratorAudio.isPlaying && audioNum != audioFiles.Capacity)
        {
            narratorAudio.clip = currAudio;
            narratorAudio.Play();
            audioPlay = true;
            //Debug.Log("Playing audio");
        }

        if (audioNum == 0 && audioPlay)
        {
            overlay.SetActive(true);
        }

        if (!narratorAudio.isPlaying && audioPlay && !videoPlay)
        {
            audioPlay = false;
            audioNum++;
            //Debug.Log(audioNum);
            videoPlay = true;
            if (audioNum != audioFiles.Capacity)
            {
                //Debug.Log("Switching tracks");
                currAudio = Resources.Load <AudioClip>("Audio/Section1/" + audioFiles[audioNum]);
            }
        }

        if (videoPlay && !audioPlay && videoNum != videoFiles.Capacity)
        {
            if (videoNum == 0 && sceneStarted)
            {
                //Debug.Log("Scene starting");
                playVideo.videoPlayer.enabled = true;
                playVideo.videoCanvas.SetActive(true);
            }
            if (videoNum == 1 && placed)
            {
                playVideo.videoPlayer.enabled = true;
                playVideo.videoCanvas.SetActive(true);
            }
            if (videoNum == 2 && markerReached && blocker)
            {
                playVideo.videoPlayer.enabled = true;
                playVideo.videoCanvas.SetActive(true);
            }
        }


        //Image disappears at correct time
        if (playVideo.videoPlayer.isPlaying && videoNum == 1 && playVideo.videoPlayer.time >= 39)
        {
            sceneObjects[1].SetActive(false);
        }


        //Make the plantation markers appear at the correct time
        if (playVideo.videoPlayer.isPlaying && videoNum == 1 && playVideo.videoPlayer.time >= 77)
        {
            sceneObjects[3].SetActive(true);
            sceneObjects[7].SetActive(true);
        }

        //Plantation markers disappear, cube showing user where to go appears
        if (!playVideo.videoPlayer.isPlaying && videoNum == 2)
        {
            sceneObjects[3].SetActive(false);
            sceneObjects[6].SetActive(true);
        }

        if (controller.GetButtonDown(GvrControllerButton.TouchPadButton))
        {
            Debug.Log("Video: " + !playVideo.videoPlayer.isPlaying + " Video num: " + (videoNum == 2) + " Faded " + !faded);
            if (!playVideo.videoPlayer.isPlaying && videoNum == 2 && !faded)
            {
                markerReached = true;
                sceneObjects[6].SetActive(false);
                visionBlocker.SetActive(true);
                //visionBlock.FadeIn();
                Debug.Log("Vision blocker fading in 1");
            }
        }

        if (markerReached && visionBlock.image.color.a == 1 && !blocker && time == 10000.0f)
        {
            //Debug.Log("setting time");
            faded = true;
            time  = Time.time;
        }

        //Debug.Log("time " + time);

        //Debug.Log("Marker reached: " + (markerReached) + " Faded in: " + faded + " blocker: " + !blocker + " Time met: " + (Time.time - time >= 2.0f));

        if (markerReached && faded && !blocker && Time.time - time >= 4.0f)
        {
            GvrBetaHeadset.SetSeeThroughConfig(GvrBetaSeeThroughCameraMode.Disabled, GvrBetaSeeThroughSceneType.Virtual);
            //visionBlock.FadeOut();
            Debug.Log("Vision blocker fading out 1");
            sceneObjects[0].SetActive(false);
            sceneObjects[3].SetActive(false);
            sceneObjects[6].SetActive(false);
            sceneObjects[4].SetActive(true);
            sceneObjects[8].SetActive(true);
            blocker = true;
            visionBlocker.SetActive(false);
            //visionBlock.FadeOut();
        }

        if (playVideo.videoPlayer.isPlaying && videoNum == 2)
        {
            sceneObjects[6].SetActive(false);
        }

        if (playVideo.videoPlayer.isPlaying && videoNum == 2 && playVideo.videoPlayer.time >= 26)
        {
            sceneObjects[4].SetActive(false);
            sceneObjects[8].SetActive(false);
            sceneObjects[5].SetActive(true);
            sceneObjects[9].SetActive(true);
        }

        if (playVideo.videoPlayer.isPlaying && videoNum == 2 && playVideo.videoPlayer.time >= 38 && !sceneEnding)
        {
            Debug.Log("Vision blocker fading in 2");
            visionBlocker.SetActive(true);
            time        = Time.time;
            sceneEnding = true;
        }

        if (playVideo.videoPlayer.isPlaying && videoNum == 2 && playVideo.videoPlayer.time >= 38.5f && sceneEnding)
        {
            sceneObjects[5].SetActive(false);
            sceneObjects[9].SetActive(false);
        }

        if (sceneEnding && Time.time - time >= 4.0f && visionBlocker.activeSelf)
        {
            Debug.Log("Vision blocker fading out 2");
            visionBlocker.SetActive(false);
            GvrBetaHeadset.SetSeeThroughConfig(GvrBetaSeeThroughCameraMode.RawImage, GvrBetaSeeThroughSceneType.Augmented);
        }

        /*
         * if(visionBlocker.activeSelf && videoNum == 2)
         * {
         *  visionBlocker.SetActive(false);
         * }
         *
         * if(markerReached && videoNum == 2)
         * {
         *  visionBlocker.SetActive(true);
         *  GvrBetaHeadset.SetSeeThroughConfig(GvrBetaSeeThroughCameraMode.Disabled, GvrBetaSeeThroughSceneType.Virtual);
         * }
         */

        if (imageOverlay.anchored && !placed)
        {
            placed = true;
            overlay.transform.position = player.transform.TransformPoint(Vector3.forward * 0 + Vector3.right * 0 + Vector3.down * 2);
            sceneObjects[0].SetActive(true);
            sceneObjects[1].SetActive(true);
        }
    }