示例#1
0
 protected override void Awake()
 {
     base.Awake();
     if (FadeInOnAwake)
     {
         _CanvasGroup.alpha = 1.0f;
         Fading.FadeToZero(true);
     }
 }
示例#2
0
        public void Play(Texture movie)
        {
#if SUPPORTMOVIE
            if (_Fading != null)
            {
                _Fading.Alpha = 1.0f;
            }

            if (_LastMovie != null)
            {
                _LastMovie.Stop();
                if (_Audio != null && _LastMovie.audioClip != null)
                {
                    _Audio.Stop();
                    _Audio.clip = null;
                }
            }
            if (movie != null && movie is MovieTexture)
            {
                MovieTexture movieTexture = (MovieTexture)movie;

                _LastMovie = movieTexture;
                movieTexture.Play();
                if (_Audio != null && movieTexture.audioClip != null)
                {
                    _Audio.clip = movieTexture.audioClip;
                    _Audio.Play();
                }
                if (_Fading != null)
                {
                    _Fading.FadeToZero(true);
                    _MovieTW.Begin(Mathf.Max(movieTexture.duration - _Fading.FadeOutTime, _Fading.FadeOutTime + 0.1f));
                }
                else
                {
                    _MovieTW.Begin(movieTexture.duration);
                }

                _EndTW.End();
                _ImgMovie.Texture     = movie;// change texture
                _SavedCutSceneEnable  = Global.CutSceneEnable;
                Global.CutSceneEnable = CutSceneEnable;
                if (SceneFading != null)
                {
                    SceneFading.FadeToOne();
                }
                OnBegin();
            }
            else
            {
                _ImgMovie.Texture = null;
            }
            enabled = true;
#endif
        }
示例#3
0
        /// <summary> Update </summary>
        protected override void Update()
        {
            if (_MovieTW.IsEnabled)
            {
                if (_MovieTW.IsOver)
                {
                    EndMovie();
                }
                else if (_MovieTW.ElapsedTime > AllowEscapeAfter)
                {
                    if (Escape())// if user press escape button
                    {
                        EndMovie();
                    }
                }
            }
            else if (_EndTW.IsEnabled)
            {
                if (_EndTW.IsOver)
                {
#if SUPPORTMOVIE
                    if (_LastMovie != null)
                    {
                        _LastMovie.Stop();
                    }
#endif
                    _MovieTW.End();
                    _ImgMovie.Texture = null;
                    enabled           = false;
                    if (CutSceneEnable)
                    {
                        Global.CutSceneEnable = _SavedCutSceneEnable;
                    }
                    if (SceneFading != null)
                    {
                        SceneFading.FadeToZero();
                    }
                    OnEnd();
#if SUPPORTMOVIE
                    _LastMovie = null;
#endif
                }
            }
            else
            {
                enabled = false;
            }
            _Frame.Update();
            base.Update();
        }
示例#4
0
 public void StartRain()
 {
     if (_IsRaining)
     {
         return;
     }
     _IsRaining = true;
     _RainAudio.Play();
     _Fading.FadeToZero();
     _Starting            = true;
     _Stopping            = false;
     RainLight.enabled    = true;
     Particle.minEmission = 0;
     Particle.maxEmission = 0;
     Particle.gameObject.SetActive(true);
     Specular.SpecularColor = Specular.DefaultColor;
     _FadeTW.Begin(_Fading.FadeInTime + 0.1f);
 }
示例#5
0
        private void MoveNext()
        {
            _NextSplashTW.End();
            // stop previous movie
#if SUPPORTMOVIE
            if (_CurrentSplashIndex >= 0)
            {
                if (Images[_CurrentSplashIndex].Image is MovieTexture)
                {
                    MovieTexture movie = (MovieTexture)Images[_CurrentSplashIndex].Image;
                    movie.Stop();
                    if (_Audio != null && movie.audioClip != null)
                    {
                        _Audio.Stop();
                        _Audio.clip = null;
                    }
                }
            }
#endif

            _CurrentSplashIndex++;                   // go next splash
            if (_CurrentSplashIndex < Images.Length) // if another splash exist
            {
#if SUPPORTMOVIE
                if (Images[_CurrentSplashIndex].Image is MovieTexture)
                {
                    MovieTexture movie = (MovieTexture)Images[_CurrentSplashIndex].Image;
                    movie.Play();
                    if (_Audio != null && movie.audioClip != null)
                    {
                        _Audio.clip = movie.audioClip;
                        _Audio.Play();
                    }
                    if (FullScreenMovies)
                    {
                        SetSize(1.0f, 1.0f, Images[_CurrentSplashIndex].Scale);
                    }
                    else
                    {
                        SetSize(Images[_CurrentSplashIndex].WidthPercent, Images[_CurrentSplashIndex].HeightPercent, Images[_CurrentSplashIndex].Scale);
                    }

                    if (_Fading != null)
                    {
                        _Fading.FadeToZero(true);
                        _SplashTW.Begin(Mathf.Max(movie.duration - _Fading.FadeOutTime, Images[_CurrentSplashIndex].MaxDuration - _Fading.FadeOutTime, _Fading.FadeOutTime + 0.1f));
                    }
                    else
                    {
                        _SplashTW.Begin(Mathf.Max(movie.duration - 0.1f, Images[_CurrentSplashIndex].MaxDuration - 0.1f, 0.1f));
                    }
                }
                else
                {
#endif
                SetSize(Images[_CurrentSplashIndex].WidthPercent, Images[_CurrentSplashIndex].HeightPercent, Images[_CurrentSplashIndex].Scale);
                if (_Fading != null)
                {
                    _Fading.FadeToZero(true);
                    _SplashTW.Begin(Mathf.Max(Images[_CurrentSplashIndex].MaxDuration - _Fading.FadeOutTime, _Fading.FadeOutTime + 0.1f));
                }
                else
                {
                    _SplashTW.Begin(Mathf.Max(Images[_CurrentSplashIndex].MaxDuration - 0.1f, 0.1f));
                }
#if SUPPORTMOVIE
            }
#endif

                _ImgSplash.Texture = Images[_CurrentSplashIndex].Image;// change texture
            }
            else
            {
                if (_Fading != null)
                {
                    _Fading.Alpha = 1.0f;
                }
                _ImgSplash.Texture = null;
            }
        }