Esempio n. 1
0
        /// <summary>
        /// Change the alpha of the fading canvas and set the current teleporting state if the fade in/out is done
        /// </summary>
        private Material HandlePlaneAlpha(ref CameraFadeParameters cameraFade, RenderMesh renderMesh, bool isFadingIn)
        {
            Material newMat = renderMesh.material;
            Color color = newMat.color;

            // If we are currently Fading In
            if (isFadingIn)
            {
                color.a -= Time.deltaTime * cameraFade.FadingSpeed;

                // If the fadingIn is finished
                if (color.a < 0)
                {
                    color.a = 0.0f;
                    this.Enabled = false;
                    new OnFadingInEndedEvent();
                }
            }
            // If we are currently Fading Out
            else
            {
                color.a += Time.deltaTime * cameraFade.FadingSpeed;

                // if the alpha is completely dark, we're done with the fade Out
                if (color.a > 1)
                {
                    color.a = 1.0f;
                    this.Enabled = cameraFade.ShouldImmediatlyFadeIn;
                    new OnFadingOutEndedEvent();
                }
            }

            newMat.color = color;
            return newMat;
        }
Esempio n. 2
0
 public static void ResetParameters(ref CameraFadeParameters cameraFade)
 {
     cameraFade.FadingSpeed = cameraFade.OldFadingSpeedFactor;
 }