// Use this for initialization
 void Start()
 {
     this.fadeIn          = false;
     this.fadeOut         = false;
     this.fadeState       = EFadeState.NONE;
     this._fadeAlphaColor = GUI.color;
 }
Example #2
0
 private IEnumerator FadeOut()
 {
     this.State = EFadeState.FadeOut;
     while (circleRad > 0.0f)
     {
         this.circleRad -= FADE_SPEED;
         this.material.SetFloat("_Rad", this.circleRad / this.maxCircleRad);
         yield return(new WaitForFixedUpdate());
     }
     this.circleRad = 0.0f;
     this.State     = EFadeState.End;
 }
Example #3
0
 //Coroutine
 private IEnumerator FadeIn()
 {
     this.State = EFadeState.FadeIn;
     while (circleRad < this.maxCircleRad)
     {
         this.circleRad += FADE_SPEED;
         this.material.SetFloat("_Rad", this.circleRad / this.maxCircleRad);
         yield return(new WaitForFixedUpdate());
     }
     this.circleRad = this.maxCircleRad;
     this.State     = EFadeState.End;
 }
Example #4
0
 protected virtual void Update()
 {
     if (!m_configSaysFade)
     {
         return;
     }
     if (m_locked)
     {
         return;
     }
     if (m_fadeState == EFadeState.DONE)
     {
         return;
     }
     if (m_fadeState == EFadeState.FADE_IN)
     {
         if (m_currentAlpha < 1f)
         {
             m_currentAlpha += 0.05f;
             FadeComponents(m_currentAlpha);
         }
         else
         {
             if (m_isHovered)
             {
                 return;
             }
             m_currentAlpha = 1f;
             FadeComponents(m_currentAlpha);
             m_waitTime  = Time.time + m_configFadeDelay;
             m_fadeState = EFadeState.WAITING;
         }
     }
     else if (m_fadeState == EFadeState.FADE_OUT)
     {
         if (m_currentAlpha > 0f)
         {
             m_currentAlpha -= 0.05f;
             FadeComponents(m_currentAlpha);
         }
         else
         {
             m_currentAlpha = 0f;
             FadeComponents(m_currentAlpha);
             m_fadeState = EFadeState.DONE;
         }
     }
     else if (m_fadeState == EFadeState.WAITING && m_waitTime <= Time.time)
     {
         m_fadeState = EFadeState.FADE_OUT;
     }
 }
    void OnGUI()
    {
        if ((!this.fadeIn && !this.fadeOut) || this.fadeState == EFadeState.DISABLED)
        {
            return;
        }

        if (this.fadeState == EFadeState.NONE && this._sceneTime <= 0)
        {
            this._fadeAlphaColor.a = 1.0f;
            GUI.color = this._fadeAlphaColor;
            GUI.DrawTexture(
                new Rect(0, 0, Screen.width, Screen.height),
                this.fadeTexture);
        }

        if (this.fadeIn && !this.fadeOut)
        {
            this._fadeAlphaColor.a = 1.0f - (this._sceneTime / this._fadeTime);
            GUI.color = this._fadeAlphaColor;
            GUI.DrawTexture(
                new Rect(0, 0, Screen.width, Screen.height),
                this.fadeTexture);
            if (this._sceneTime >= this._fadeTime)
            {
                this._sceneTime = 0;
                this.fadeIn     = false;
                this.fadeState  = EFadeState.IN_COMPLETE;
            }

            return;
        }

        else if (!this.fadeIn && this.fadeOut)
        {
            this._fadeAlphaColor.a = this._sceneTime / this._fadeTime;
            GUI.color = this._fadeAlphaColor;
            GUI.DrawTexture(
                new Rect(0, 0, Screen.width, Screen.height),
                this.fadeTexture);

            if (this._sceneTime >= this._fadeTime)
            {
                this._sceneTime = this._fadeTime;
                this.fadeState  = EFadeState.OUT_COMPLETE;
            }

            return;
        }
    }
Example #6
0
 void Update()
 {
     if (!_updateWasCalledAfterLevelLoad)
     {
         if (_state == EFadeState.kFadeState_LoadAnotherLevel)
         {
             LoadLevel();
         }
         else
         {
             _state = EFadeState.kFadeState_FadeOut;
             FadeOut();
         }
         _updateWasCalledAfterLevelLoad = true;
     }
 }
Example #7
0
 public virtual void OnHover(Boolean p_isHovered)
 {
     m_isHovered = p_isHovered;
     if (m_isAlreadyFadingIn || m_locked)
     {
         return;
     }
     if (m_isHovered)
     {
         m_fadeState = EFadeState.FADE_IN;
     }
     else if (m_currentAlpha < 1f)
     {
         m_fadeState = EFadeState.FADE_OUT;
     }
     else
     {
         m_waitTime  = Time.time + m_configFadeDelay;
         m_fadeState = EFadeState.WAITING;
     }
 }
 public void CleanFade()
 {
     this._sceneTime = 0;
     this.fadeState  = EFadeState.NONE;
 }
 public void DisableFade()
 {
     this.fadeIn    = false;
     this.fadeOut   = false;
     this.fadeState = EFadeState.DISABLED;
 }