Example #1
0
    public IEnumerator LoadNextGame()
    {
        ovrScreenFade.FadeOut();
        yield return(fadeDelay);

        Star.AddNewStar();
        Goal.SetNewPosition(spawningArea.GetGoalRandomPlace());
        Ball.Self.ResetPosition();
        ovrScreenFade.FadeIn();
    }
Example #2
0
    private void ClickToMove(Ray pointer)
    {
        // If trigger is released, teleport to that location
        if (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) < 0.1f && shouldTeleport)
        {
            fader.FadeOut();
            Teleport(teleportPoint);
            fader.FadeIn();
            lastTeleport   = Time.time;
            shouldTeleport = false;
        }

        // Teleporting up the round tower
        if (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) < 0.1f && doorTeleport)
        {
            fader.FadeOut();
            Teleport(new Vector3(-40.22f, 15f, -40.56f));
            fader.FadeIn();
            lastTeleport = Time.time;
            doorTeleport = false;
        }

        RaycastHit laserHit;

        // If the ray hits a teleportable location
        if (Physics.Raycast(pointer, out laserHit, 500.0f))
        {
            if (laserHit.transform.gameObject.layer == LayerMask.NameToLayer("CanTeleport"))
            {
                // Display a reticle at the target.
                reticle.SetActive(true);
                reticle.transform.position = laserHit.point + offset;

                if (Time.time - lastTeleport > teleportDelay)
                {
                    shouldTeleport = true;
                    teleportPoint  = laserHit.point;
                }
            }
            else
            {
                reticle.SetActive(false);
                shouldTeleport = false;
            }

            // The round tower door
            if (laserHit.transform.gameObject.layer == LayerMask.NameToLayer("Door"))
            {
                doorTeleport = true;
            }
        }
    }
 void MoveToFinalScene()
 {
     screenfade.fadeTime = 7;
     screenfade.FadeOut(() => SceneManager.LoadScene("FireworkScene"));
     PlayerState.singleton.GetComponent <Animator>().SetBool("Push", true);
     audioSource.PlayOneShot(fireworkMachine, 0.7F);
 }
Example #4
0
    public void MoveCamera(string direction)
    {
        fader.FadeOut();
        Transform tran = transform;

        if (direction == "Right")
        {
            tran = stat.NextSpot();
            webvrCamera.transform.parent.position = tran.position + new Vector3(0, -1.5f, 0);
            webvrCamera.transform.parent.rotation = tran.rotation;
        }

        else if (direction == "Left")
        {
            tran = stat.PrevSpot();
            webvrCamera.transform.parent.position = tran.position + new Vector3(0, -1.5f, 0);
            webvrCamera.transform.parent.rotation = tran.rotation;
        }

        // User has selected the hotspot
        else if (direction == "HotSpot")
        {
            tran = currentHotspot.transform;
            webvrCamera.transform.position = tran.position;
            currentHotspot.OpenVRPanel();
            dimmer.SetActive(true);
        }

        fader.FadeIn();
    }
 public static void ResetGame()
 {
     screenFade.SetBlack();
     screenFade.FadeOut();
     character.transform.position = initialPosition;
     character.transform.rotation = initialOrientation;
 }
Example #6
0
 //Trigger en la cinemática Interval
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         _visionFade.FadeOut();
         Invoke("CompleteLoad", 2.0f);
     }
 }
Example #7
0
 //Botón de exit del manu de pausa
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Hands"))
     {
         _visionFade.FadeOut();
         Invoke("CompleteExitGame", 2.0f);
     }
 }
    public IEnumerator endDelay()
    {
        yield return(new WaitForSecondsRealtime(10));

        screenfade.FadeOut(() =>
                           SceneManager.LoadScene(fireworksWorkStationScene, LoadSceneMode.Single)
                           );
    }
Example #9
0
 //Al pasar por el trigger en la pantalla de game over se vuelve a la escena 2 (nuevo intento)
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Hands"))
     {
         _visionFade.FadeOut();
         Invoke("CompleteReturnToMainScene", 2.0f);
         StartCoroutine(AudioController.FadeOut(_backgroundMusic, 5f));
     }
 }
Example #10
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         screenfade.FadeOut(() =>
                            SceneManager.LoadScene(sceneName, LoadSceneMode.Single)
                            );
     }
 }
Example #11
0
    public IEnumerator FadeOutIn()
    {
        //Fade In and Fade Out
        fadeMaster.FadeOut();
        yield return(new WaitForSeconds(fadeSeconds));

        QuestionPanels.SetActive(true);
        _playerRB.Acceleration = 0.0f;
        fadeMaster.FadeIn();
    }
Example #12
0
 void Update()
 {
     // accept keyboard input for development purpose
     if (OVRInput.GetDown(OVRInput.RawButton.A) ||
         Input.GetKeyDown(KeyCode.A))
     {
         clickSound.Play();
         //screenFade.fadeColor = Color.white;
         screenFade.fadeColor = Color.black;
         screenFade.FadeOut();
         SceneManager.LoadScene(1, LoadSceneMode.Single);
     }
 }
Example #13
0
    public IEnumerator PlayerTransition(Vector3 newPosition)
    {
        // Fade out screen only if screen is not faded
        sF.FadeOut();
        yield return(new WaitForSeconds(sF.fadeTime + 0.1f));

        // Move the player transform to the desired location
        player.transform.position = newPosition;

        // Fade in screen
        //isTeleporting = false;
        sF.FadeIn();
        yield return(new WaitForSeconds(sF.fadeTime));
    }
Example #14
0
    //Paro al personaje y lanzo el GameOver
    protected override void Die()
    {
        if (_IAmDead)
        {
            return;
        }

        _IAmDead = true;
        CharacterController _chara = GetComponent <CharacterController>();

        _chara.enabled = false;
        _deathSound.Play();
        _visionFade.FadeOut(); //Fundido en negro
        Invoke("CompleteLoadGameOver", 2.0f);
    }
Example #15
0
    //Botón de exit de la demo desde el menú de pausa
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Hands"))
        {
            //Aparece Texto
            _text.gameObject.SetActive(true);

            //Si se pulsa cualquiera de los gatillos, se sale del juego
            if (OVRInput.Get(OVRInput.Axis1D.SecondaryHandTrigger) >= 0.55f ||
                OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger) >= 0.55f)
            {
                _visionFade.FadeOut();
                Invoke("CompleteExit", 2.0f);
            }
        }
    }
Example #16
0
    bool TriggerAction()
    {
        // Do whatever you need to do when trap is opening
        Debug.Log($"Exit trap is open now = {transform.position} at {Time.fixedTime}");

        OVRCameraRig  rig = FindObjectOfType <OVRCameraRig>();
        OVRScreenFade _screenFadeScript = rig.GetComponent <OVRScreenFade>();

        if (_screenFadeScript != null)
        {
            //_screenFadeScript.SetFadeLevel(fadeLevel * MaxFade);
            _screenFadeScript.FadeOut();
        }

        return(true);
    }
Example #17
0
    // Update is called once per frame
    void Update()
    {
        if (fadeCountDown > 0)
        {
            if (fadeCountDown == fadeTimer)
            {
                screenFade.FadeOut();
            }

            fadeCountDown -= Time.deltaTime;
        }
        else if (transform.position != nextTransform.position)
        {
            transform.SetPositionAndRotation(nextTransform.position, nextTransform.rotation);

            //transform.position = nextTransform.position;
            screenFade.FadeIn();
            fadeCountDown = 0;
        }
    }
Example #18
0
    private IEnumerator DelayedDeath()
    {
        AudioSource snd = TheCellGameMgr.instance.Audio_DeathScream[0];

        snd.Play();

        yield return(new WaitForSecondsRealtime(3.0f));

        Debug.Log($"[OneCellClass] Kill the player sub {cellSubType}, go back at start. DeathTime = {Time.fixedTime - TheCellGameMgr.instance.GetGameStartTime()}");

        OVRCameraRig  rig = FindObjectOfType <OVRCameraRig>();
        OVRScreenFade _screenFadeScript = rig.GetComponent <OVRScreenFade>();

        if (_screenFadeScript != null)
        {
            _screenFadeScript.fadeColor = new Color(0.5f, 0.0f, 0.0f);
            _screenFadeScript.FadeOut();
        }

        StartCoroutine(TeleportToStart());
    }
Example #19
0
    /// <summary>
    /// Fading transition between views.
    /// </summary>
    /// <param name="waitTime">Time spent with screen fully black, in seconds</param>
    /// <param name="test">Test methods are to be ran on.</param>
    /// <param name="method">Method ran after fadeout, but before fadein.</param>
    /// <param name="secondMethod">Method ran after fadein.</param>
    /// <param name="fadeout">True if view should fade out, false if cutting straight to black.</param>
    /// <returns></returns>
    IEnumerator WaitThenActivate(float waitTime, Test test, myMethod method = null, myMethod secondMethod = null, bool fadeout = true)
    {
        transitioning = true;
        if (fadeout)
        {
            screenFade.FadeOut();
        }
        yield return(new WaitForSeconds(screenFade.fadeTime));

        if (method != null)
        {
            method(test);
        }
        yield return(new WaitForSeconds(waitTime));

        screenFade.FadeIn();
        if (secondMethod != null)
        {
            secondMethod(test);
        }
        transitioning = false;
    }
Example #20
0
 private void LoadCompleteExitApplication()
 {
     _visionFade.FadeOut();
     Invoke("LoadNextScene", 2.0f);
 }
Example #21
0
 private void StartLoadNextScene()
 {
     _visionFade.FadeOut();
     _carAudio.PlayOneShot(_carAudio.clip);
     Invoke("EndLoadNextScene", 2.0f);
 }
Example #22
0
 //Fundido en negro y carga de créditos finales
 public void Fade()
 {
     _visionFade.FadeOut();
     Invoke("LoadCredits", 2.0f);
 }
Example #23
0
    private void ClickToMove(Ray pointer)
    {
        if (Controller.GetPress(SteamVR_Controller.ButtonMask.Touchpad))
        {
            lineRenderer.enabled = true;
            reticle.SetActive(true);

            // Create and draw ray
            lineRenderer.enabled = true;
            lineRenderer.SetPosition(0, pointer.origin);
            lineRenderer.SetPosition(1, pointer.origin + pointer.direction * 500.0f);
            RaycastHit laserHit;


            // If the ray hits a teleportable location
            if (Physics.Raycast(pointer, out laserHit, 500.0f))
            {
                if (laserHit.transform.gameObject.layer == LayerMask.NameToLayer("CanTeleport"))
                {
                    // Display a reticle at the target.
                    reticle.SetActive(true);
                    reticle.transform.position = laserHit.point + offset;

                    if (Time.time - lastTeleport > teleportDelay)
                    {
                        shouldTeleport = true;
                        teleportPoint  = laserHit.point;
                    }
                }
                else
                {
                    reticle.SetActive(false);
                }

                // The round tower door
                if (laserHit.transform.gameObject.layer == LayerMask.NameToLayer("Door"))
                {
                    doorTeleport = true;
                }
            }
        }
        else
        {
            reticle.SetActive(false);
            lineRenderer.enabled = false;
        }

        // If trigger is pressed, teleport to that location
        if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad) && shouldTeleport)
        {
            fader.FadeOut();
            Teleport(teleportPoint);
            fader.FadeIn();
            lastTeleport   = Time.time;
            shouldTeleport = false;
        }

        // Teleporting up the round tower
        if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad) && doorTeleport)
        {
            fader.FadeOut();
            Teleport(doorTeleportLocation.transform.position);
            fader.FadeIn();
            lastTeleport = Time.time;
            doorTeleport = false;
        }
    }
Example #24
0
 //when this function is called the screen fades out, the player is teleported to the last correct steppingstone and then the screen fades back in
 public void LastCorrectRespawn()
 {
     fader.FadeOut();
     Playr.transform.position = lastCorrectPosition + new Vector3(0f, 4.5f, 0f);
     fader.FadeIn();
 }
Example #25
0
    public IEnumerator UpdateView(string msg)
    {
        //don't allow another action while this is running
        transition = true;

        //reset teleported
        teleported = false;

        SetLabel(msg);

        GameObject textObj = viewLabel;

        textObj.SetActive(true);

        //set text properties
        TextMeshPro text     = textObj.GetComponent <TextMeshPro>();
        Color32     clr      = text.faceColor;
        Color32     otln     = text.outlineColor;
        Color32     underlay = text.fontSharedMaterial.GetColor("_UnderlayColor");

        OVRScreenFade Fader = null;

        if (isLocalPlayer && trackingSpace.transform.Find("CenterEyeAnchor").gameObject.activeSelf)
        {
            Fader = trackingSpace.transform.Find("CenterEyeAnchor").gameObject.GetComponent <OVRScreenFade>();
        }

        if (Fader)
        {
            //fade out
            Fader.fadeTime = 1f;
            Fader.FadeOut();
        }

        //invoke action and short pause
        Invoke("SetView", 1.0f);

        //wait before text fade out
        yield return(new WaitForSeconds(1f));

        if (Fader)
        {
            //fade in
            Fader.fadeTime = 2f;
            Fader.FadeIn();
        }

        //wait before text fade out
        yield return(new WaitForSeconds(1f));

        //fade text out
        float aTime = 0.5f;

        for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime)
        {
            clr.a             = (byte)Mathf.Lerp(255, 0, t);
            text.faceColor    = clr;
            otln.a            = (byte)Mathf.Lerp(255, 0, t);
            text.outlineColor = otln;
            underlay.a        = (byte)Mathf.Lerp(255, 0, t);
            text.fontSharedMaterial.SetColor("_UnderlayColor", underlay);
            yield return(null);
        }

        textObj.SetActive(false);

        //reset text color
        clr.a             = 255;
        text.faceColor    = clr;
        otln.a            = 255;
        text.outlineColor = otln;
        underlay.a        = 255;
        text.fontSharedMaterial.SetColor("_UnderlayColor", underlay);

        //allow another action
        transition = false;
    }
Example #26
0
 //Sale de la aplicación desde los créditos
 private void Fade()
 {
     _fadevision.FadeOut();
     Invoke("CompleteExitGame", 2.0f);
     StartCoroutine(AudioController.FadeOut(_backgroundMusic, 2f));
 }
Example #27
0
 public void ChangeScene(string name)
 {
     sceneToLoad = name;
     screenFade.FadeOut(() => SceneManager.LoadScene(sceneToLoad));
 }
Example #28
0
 public void FadeToBlack()
 {
     ovrsf.FadeOut();
     Invoke("FadeToNormal", 3.0f);
 }