public void update(float theFrac, OnFade onFade)
        {
            int increase = (int)(theFrac * mFadeSpeed);

            if (mFadeIn)
            {
                if (mColor.A + increase < 255)
                {
                    mColor.A += (byte)increase;
                }

                else
                {
                    mColor.A = 255;

                    mFadeIn = false;

                    onFade();
                }
            }

            else if(mAutoFadeBack)
            {
                if (mColor.A - increase > 0)
                {
                    mColor.A -= (byte)increase;
                }

                else
                {
                    mColor.A = 0;
                }
            }
        }
Exemple #2
0
 void Awake()
 {
     creator = FindObjectOfType <TPFaderCreator>();
     if (Fade == null)
     {
         Fade = () => creator.Fade(FadeToScene, FadeType);
     }
 }
Exemple #3
0
        private void DoFadeEvent(OnFade fade)
        {
            var target = (_canvasGroup.alpha >= 1) ? fadedAlpha : fullAlpha;

            Fade(_canvasGroup.alpha, target, fade.duration);
        }
Exemple #4
0
 private void OnDisable()
 {
     OnFade.UnregisterListener(DoFadeEvent);
     OnFadeIn.UnregisterListener(DoFadeInEvent);
     OnFadeOut.UnregisterListener(DoFadeOutEvent);
 }
Exemple #5
0
 private void OnEnable()
 {
     OnFade.RegisterListener(DoFadeEvent);
     OnFadeIn.RegisterListener(DoFadeInEvent);
     OnFadeOut.RegisterListener(DoFadeOutEvent);
 }
Exemple #6
0
        public void FadeEvent()
        {
            OnFade fade = new OnFade(defaultDuration);

            fade.FireEvent();
        }
Exemple #7
0
 public void SetOnFade(OnFade _onFade)
 {
     Fade = _onFade;
 }