Exemple #1
0
    void Start()
    {
        if (who == null)
        {
            who = GameObject.Find(whoIsName);
        }
        if (who == null)
        {
            Debug.LogError("Teleporte sem objeto a ser teleportado");
        }

        if (where == null)
        {
            where = GameObject.Find(whereName);
        }
        if (where == null)
        {
            if (teleportDestiny == Vector3.zero)
            {
                Debug.LogError("Teleporte sem alvo para ser teleportado");
            }
        }
        else
        {
            teleportDestiny = where.transform.position;
        }

        player     = referenceManagerIndependent.Player;
        cameraFade = ReferenceManagerIndependent.Instance.VRCameraFade;
    }
    private IEnumerator FadeToScene(string sceneName)
    {
        if (Camera.main != null)
        {
            VRCameraFade cameraFade = Camera.main.gameObject.GetComponent <VRCameraFade>();
            if (cameraFade != null)
            {
                yield return(StartCoroutine(cameraFade.BeginFadeOut(false)));
            }
        }
        //check to see if we were the scene that we preloaded
        if (!string.IsNullOrEmpty(_sceneName))
        {
            if (_sceneName == sceneName)
            {
                while (_curScene.progress <= 0.89f)
                {
                    yield return(null);
                }

                _curScene.allowSceneActivation = true;
            }
            else
            {
                LoadSceneNormal(sceneName);
            }
        }
        else
        {
            LoadSceneNormal(sceneName);
        }
    }
    void Start()
    {
        motionBase = GameObject.FindGameObjectWithTag("Player");

        if (motionBase != null)
        {
            guiArrows  = motionBase.GetComponentInChildren <GUIArrows>();
            cameraFade = motionBase.GetComponentInChildren <VRCameraFade>();
            HeadTriggerEventScript ht = motionBase.GetComponentInChildren <HeadTriggerEventScript>();
            if (ht != null)
            {
                ht.OnHeadTriggered += ht_OnHeadTriggered;
            }
        }

        if (guiArrows != null)
        {
            guiArrows.Hide();
        }

        recorder = GetComponent <RecordingServiceBehavior>();

        //Don't destroy the motion tracking base when you load the lobby
        DontDestroyOnLoad(motionBase);
        DontDestroyOnLoad(this.gameObject);

        originalTrafficChangeDelay = trafficLightChangeDelay;

        //load lobby
        SceneManager.LoadScene(1);
    }
Exemple #4
0
        public void LoadScene(SceneUtils.SceneType sceneType)
        {
            GameObject   gameObject = GameObject.FindGameObjectWithTag("MainCamera");
            VRCameraFade cameraFade = gameObject.GetComponent <VRCameraFade> ();

            StartCoroutine(LoadScene(sceneType, cameraFade));
        }
Exemple #5
0
    private bool m_GazeOver;                                                // Whether the user is looking at the VRInteractiveItem currently.


    void Awake()
    {
        m_CameraFade      = Camera.main.gameObject.GetComponent <VRCameraFade> () as VRCameraFade;
        m_SelectionRadial = Camera.main.gameObject.GetComponent <SelectionRadial> () as SelectionRadial;
        m_InteractiveItem = GetComponent <VRInteractiveItem> () as VRInteractiveItem;
        m_ButtonImage     = GetComponent <Image> () as Image;
        m_ButtonCollider  = GetComponent <BoxCollider> () as BoxCollider;
        m_canvas          = m_ButtonImage.canvas;
    }
 private void OnFadeComplete()
 {
     if (m_fading)
     {
         m_fading = false;
         MoveCamera();
         VRCameraFade cameraFade = m_Camera.GetComponent <VRCameraFade>();
         cameraFade.FadeIn(false);
     }
 }
    // Use this for initialization
    void OnEnable()
    {
        GetComponent <VRActionHarness>().OnActionTrigger += Teleport;
        VRCameraFade cameraFade = m_Camera.GetComponent <VRCameraFade>();

        if (cameraFade != null)
        {
            cameraFade.OnFadeComplete += OnFadeComplete;
        }
    }
    private bool m_GazeOver;                                                        // Whether the user is looking at the VRInteractiveItem currently.


    private void OnEnable()
    {
        attachedButton = GetComponent <Button> ();

        if (this.GetComponent <VRInteractiveItem>() != null)
        {
            m_InteractiveItem = this.GetComponent <VRInteractiveItem> ();
        }

        else
        {
            this.gameObject.AddComponent(typeof(VRInteractiveItem));
            Debug.Log("Attaching VR Interactive Script to this GameObject, it's required");
            m_InteractiveItem = this.GetComponent <VRInteractiveItem> ();
        }

        if (this.GetComponent <BoxCollider>() == null)
        {
            this.gameObject.AddComponent(typeof(BoxCollider));
            GetComponent <BoxCollider> ().size = new Vector3(this.GetComponent <RectTransform> ().rect.width, this.GetComponent <RectTransform> ().rect.height, 1);
            Debug.Log("Attaching Box collider to this GameObject, it's required");
        }

        if (VRInteractiveCamera.GetComponent <VRCameraFade> () != null)
        {
            m_CameraFade = VRInteractiveCamera.GetComponent <VRCameraFade> ();
        }
        else
        {
            Debug.Log("No VRCameraFade Script attached to the VR Interactive Camera, it's required");
        }

        if (VRInteractiveCamera.GetComponent <SelectionRadial>() != null)
        {
            m_SelectionRadial = VRInteractiveCamera.GetComponent <SelectionRadial> ();
        }
        else
        {
            Debug.Log("No SelectionRadial Script attached to the VR Interactive Camera, it's required");
        }

        if (gazeTimeForSelection == 0)
        {
            gazeTimeForSelection = 1;
        }

        m_InteractiveItem.OnOver += HandleOver;
        m_InteractiveItem.OnOut  += HandleOut;
        m_SelectionRadial.OnSelectionComplete += HandleSelectionComplete;
    }
    // toggles the audio from playing to stopping
    private void Teleport()
    {
        Debug.Log("teleport");
        VRCameraFade cameraFade = m_Camera.GetComponent <VRCameraFade>();

        if (cameraFade != null)
        {
            cameraFade.FadeOut(false);
            m_fading = true;
        }
        else
        {
            MoveCamera();
        }
    }
    private IEnumerator FadeToScene(string sceneName, GameObject underlayVideo, GameObject underlayEnvironment)
    {
        if (Camera.main != null)
        {
            VRCameraFade cameraFade = Camera.main.gameObject.GetComponent <VRCameraFade>();
            if (cameraFade != null)
            {
                yield return(StartCoroutine(cameraFade.BeginFadeOut(false)));
            }
        }
        underlayVideo.gameObject.SetActive(false);
        underlayEnvironment.gameObject.SetActive(false);

        SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
    }
Exemple #11
0
    private void Awake()

    {
        if (instance != null)
        {
            Debug.Log("EXISTE UNA INSTANCIA MAS DE ESTE COMPONENTE " + GetType());
        }
        else
        {
            instance = this;
        }
        SceneManager.sceneLoaded += HandleSceneLoaded;

        m_FadeOutColor      = new Color(m_FadeColor.r, m_FadeColor.g, m_FadeColor.b, 0f);
        m_FadeImage.enabled = true;
    }
Exemple #12
0
        public IEnumerator LoadScene(SceneUtils.SceneType sceneType, VRCameraFade cameraFade)
        {
            //Set the previous scene name
            LevelManager.PreviousSceneType = SceneUtils.GetSceneType(SceneManager.GetActiveScene().name);

            if (cameraFade.IsFading)
            {
                yield break;
            }

            // Wait for the screen to fade out.
            yield return(StartCoroutine(cameraFade.BeginFadeOut(true)));

            // Load the main menu by itself.
            SceneManager.LoadScene(SceneUtils.GetSceneName(sceneType), LoadSceneMode.Single);
        }
    //Obsługa teleportu
    private void Teleport()
    {
        // Create a ray that points forwards from the camera.
        Ray        ray = new Ray(m_Camera.position, m_Camera.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, m_RayLength, ~m_ExclusionLayers))
        {
            Vector3 location = new Vector3(hit.point.x, hit.point.y + 1.8f, hit.point.z);
            if (hit.point.y < 0.1f)
            {
                VRCameraFade fade = gameObject.GetComponent(typeof(VRCameraFade)) as VRCameraFade;
                if (fade != null)
                {
                    fade.FadeIn(false);
                }
                gameObject.transform.position = location;
                if (fade != null)
                {
                    fade.FadeOut(false);
                }
            }
        }
    }
Exemple #14
0
    public IEnumerator GoToScene(string m_SceneToLoad, string mediaUrlContent)
    {
        m_CameraFade = m_VRPlatformSelector.getCameraActive.GetComponent <VRCameraFade>();
        urlContent   = mediaUrlContent;
        //Just in case nothing is attached
        if (m_CameraFade != null)
        {
            // If the camera is already fading, ignore.
            if (m_CameraFade.IsFading)
            {
                yield break;
            }

            // Wait for the camera to fade out.
            yield return(StartCoroutine(m_CameraFade.BeginFadeOut(true)));

            print("sceneToLoad" + m_SceneToLoad);
            if (!String.IsNullOrEmpty(m_SceneToLoad))
            {
                // Load the level.
                SceneManager.LoadScene(m_SceneToLoad, LoadSceneMode.Single);
            }
        }
    }
Exemple #15
0
    [SerializeField] private string m_SceneToLoad;                      // The name of the scene to load.


    private void Start()
    {
        cameraFade = referenceManager.VRCameraFade;
    }
Exemple #16
0
    private void Start()
    {
        GameObject camera = GameObject.FindGameObjectWithTag("MainCamera");

        m_CameraFade = (VRCameraFade)camera.GetComponent <VRCameraFade> ();
    }
Exemple #17
0
 public void GoToHomeScene(VRCameraFade cameraFade)
 {
     StartCoroutine(LoadScene(SceneUtils.SceneType.STARTSCENE, cameraFade));
 }
Exemple #18
0
 // Use this for initialization
 void Start()
 {
     dayTimeBool = false;
     fade        = gameObject.GetComponent(typeof(VRCameraFade)) as VRCameraFade;
 }
Exemple #19
0
    [SerializeField] private string m_SceneToLoad;                      // The name of the scene to load.

    override protected void Start()
    {
        base.Start();
        cameraFade = referenceManagerIndependent.VRCameraFade;
    }
 private void Start()
 {
     cameraFade  = ReferenceManager.Instance.VRCameraFade;
     m_Selection = ReferenceManager.Instance.SelectionRadialSlider;
 }