Ejemplo n.º 1
0
 private void FadeCalculation()
 {
     lastJoystickAngle = 0f;
     elapsedTime      += Time.deltaTime;
     if (elapsedTime < transitionTime)
     {
         if (!teleported && elapsedTime >= transitionTime * 0.5f)
         {
             teleported = true;
             m_characterController.enabled = false;
             m_charTransform.position      = finalDestination;
             if (rotatePlayerWhenLocomoting)
             {
                 m_charTransform.rotation = finalRotation;
             }
             m_characterController.enabled = true;
         }
         float fadeLevel = FadeLevels.Evaluate(elapsedTime / transitionTime);
         // m_screenFader.SetFadeLevel(fadeLevel);
         m_screenFader.SetExplicitFade(fadeLevel);
     }
     else
     {
         StopLocomotion();
     }
 }
Ejemplo n.º 2
0
    /// Similar to `InstantTeleport()`, except with a fade-in and fade-out effect on the user's visuals.
    public IEnumerator FadeTeleport(Vector3 destination, float timeToFade)
    {
        float elapsedTime = 0;
        bool  teleported  = false;

        while (elapsedTime < timeToFade)
        {
            yield return(null);

            elapsedTime += Time.deltaTime;
            if (!teleported && elapsedTime >= timeToFade * 0.5f)
            {
                teleported = true;
                m_characterController.enabled = false;
                m_charTransform.position      = destination;
                m_characterController.enabled = true;
            }
            float fadeLevel = FadeLevels.Evaluate(elapsedTime / timeToFade);
            //m_screenFader.SetFadeLevel(fadeLevel);
            m_screenFader.SetExplicitFade(fadeLevel);
        }

        //m_screenFader.SetFadeLevel(0);
        m_screenFader.SetExplicitFade(0);
        m_isTeleporting = false;
        yield return(null);
    }