Ejemplo n.º 1
0
        private void StartFade(SceneDescription newScene, Fade fadeIn, Fade fadeOut, float delay = 0)
        {
            if (this.IsFading)
            {
                FlaiDebug.LogWarningWithTypeTag <SceneFader>("Can't start a new fade. There is already another fade in progress", this);
                return;
            }
            else if (this.IsFadeDelayRunning)
            {
                FlaiDebug.LogWarningWithTypeTag <SceneFader>("Can't start a new fade. There is already another fade pending (delay: " + _fadeDelay.Value + "}", this);
                return;
            }

            Ensure.NotNull(fadeIn, "'fadeIn' cannot be null. Use Fade.None instead");
            Ensure.NotNull(fadeOut, "'fadeOut' cannot be null. Use Fade.None instead");

            _fadeIn    = fadeIn;
            _fadeOut   = fadeOut;
            _newScene  = newScene;
            _fadeDelay = (delay == 0) ? default(float?) : delay;

            if (!_fadeDelay.HasValue)
            {
                this.BeginFading();
            }
        }
Ejemplo n.º 2
0
 public static void Fade(SceneDescription newScene, Fade fadeIn = null, Fade fadeOut = null, float delay = 0)
 {
     // for some reason using FadeClass.Default doesn't work :| todo: fix it?
     fadeIn  = fadeIn ?? FadeClass.Create();
     fadeOut = fadeOut ?? FadeClass.Create();
     Ensure.NotNull(newScene, fadeIn, fadeOut);
     Ensure.True(delay >= 0f);
     SceneFader.Instance.StartFade(newScene, fadeIn, fadeOut, delay);
 }
Ejemplo n.º 3
0
 private void LoadLevel()
 {
     Ensure.NotNull(_newScene);
     _newScene.Load();
     _newScene = null;
 }
Ejemplo n.º 4
0
 // fades?
 public static void LoadScene(SceneDescription description)
 {
     description.Load();
 }