Esempio n. 1
0
 public Fader(float alpha, float fadeInTime, float fadeOutTime)
 {
     alpha_ = alpha;
     fadeInTime_ = fadeInTime;
     fadeOutTime_ = fadeOutTime;
     updateAlpha_ = doNothing;
 }
    //-------------------------------------------------------------------------
    void fadeIn()
    {
        // handle the case where the fadein time is zero (or negative)
        if (FadeInPeriod <= 0.0f)
        {
            Alpha        = 1.0f;
            updateAlpha_ = waitFadeOut;
            return;
        }

        float timePast = time_ - FadeInTime;

        Alpha = timePast / FadeInPeriod;

        // consider the possibility of fading out while fading in
        if (time_ > FadeOutTime)
        {
            updateAlpha_ = fadeOut;
            return;
        }

        if (timePast > FadeInPeriod)
        {
            Alpha        = 1.0f;
            updateAlpha_ = waitFadeOut;
        }
    }
    //-------------------------------------------------------------------------
    void fadeIn()
    {
        // handle the case where the fadein time is zero (or negative)
        if (FadeInPeriod <= 0.0f)
        {
            Alpha = 1.0f;
            updateAlpha_ = waitFadeOut;
            return;
        }

        float timePast = time_ - FadeInTime;
        Alpha = timePast/FadeInPeriod;

        // consider the possibility of fading out while fading in
        if (time_ > FadeOutTime)
        {
            updateAlpha_ = fadeOut;
            return;
        }

        if (timePast > FadeInPeriod)
        {
            Alpha = 1.0f;
            updateAlpha_ = waitFadeOut;
        }
    }
Esempio n. 4
0
 public Fader(float alpha, float fadeInTime, float fadeOutTime)
 {
     alpha_       = alpha;
     fadeInTime_  = fadeInTime;
     fadeOutTime_ = fadeOutTime;
     updateAlpha_ = doNothing;
 }
 //-------------------------------------------------------------------------
 void waitFadeIn()
 {
     if (time_ >= FadeInTime && time_ <= FadeOutTime)
     {
         Alpha        = 0.0f;
         updateAlpha_ = fadeIn;
     }
 }
 //-------------------------------------------------------------------------
 void waitFadeOut()
 {
     if (time_ > FadeOutTime)
     {
         updateAlpha_ = fadeOut;
         return;
     }
 }
Esempio n. 7
0
    //-------------------------------------------------------------------------
    private void fadeIn()
    {
        if (fadeInTime_ == 0.0f)
        {
            alpha_ = 1.0f;
            updateAlpha_ = doNothing;
            return;
        }

        alpha_ += deltaTime_/fadeInTime_;

        if (alpha_ >= 1.0f)
        {
            alpha_ = 1.0f;
            updateAlpha_ = doNothing;
        }
    }
Esempio n. 8
0
    //-------------------------------------------------------------------------
    private void fadeIn()
    {
        if (fadeInTime_ == 0.0f)
        {
            alpha_       = 1.0f;
            updateAlpha_ = doNothing;
            return;
        }

        alpha_ += deltaTime_ / fadeInTime_;

        if (alpha_ >= 1.0f)
        {
            alpha_       = 1.0f;
            updateAlpha_ = doNothing;
        }
    }
Esempio n. 9
0
    //-------------------------------------------------------------------------
    private void fadeOut()
    {
        if (fadeOutTime_ == 0.0f)
        {
            alpha_       = 0.0f;
            updateAlpha_ = doNothing;
            return;
        }

        alpha_ -= deltaTime_ / fadeOutTime_;

        if (alpha_ < 0.0f)
        {
            alpha_       = 0.0f;
            updateAlpha_ = doNothing;
        }
    }
    //-------------------------------------------------------------------------
    void fadeOut()
    {
        // handle the case where the fadeout time is zero (or negative)
        if (FadeOutPeriod <= 0.0f)
        {
            Alpha        = 0.0f;
            updateAlpha_ = doNothing;
            return;
        }

        float timePast = time_ - FadeOutTime;

        Alpha = 1.0f - timePast / FadeOutPeriod;

        if (timePast > FadeOutPeriod)
        {
            Alpha        = 0.0f;
            updateAlpha_ = doNothing;
        }
    }
 //-------------------------------------------------------------------------
 //						  METHOD DEFINITIONS
 //-------------------------------------------------------------------------
 void Awake()
 {
     updateAlpha_ = waitFadeIn;
 }
Esempio n. 12
0
    //-------------------------------------------------------------------------
    private void fadeOut()
    {
        if (fadeOutTime_ == 0.0f)
        {
            alpha_ = 0.0f;
            updateAlpha_ = doNothing;
            return;
        }

        alpha_ -= deltaTime_/fadeOutTime_;

        if (alpha_ < 0.0f)
        {
            alpha_ = 0.0f;
            updateAlpha_ = doNothing;
        }
    }
Esempio n. 13
0
 public void FadeOut()
 {
     updateAlpha_ = fadeOut;
 }
 //-------------------------------------------------------------------------
 void waitFadeOut()
 {
     if (time_ > FadeOutTime)
     {
         updateAlpha_ = fadeOut;
         return;
     }
 }
Esempio n. 15
0
 public void FadeOut()
 {
     updateAlpha_ = fadeOut;
 }
Esempio n. 16
0
 public void FadeIn()
 {
     updateAlpha_ = fadeIn;
 }
    //-------------------------------------------------------------------------
    void fadeOut()
    {
        // handle the case where the fadeout time is zero (or negative)
        if (FadeOutPeriod <= 0.0f)
        {
            Alpha = 0.0f;
            updateAlpha_ = doNothing;
            return;
        }

        float timePast = time_ - FadeOutTime;
        Alpha = 1.0f - timePast/FadeOutPeriod;

        if (timePast > FadeOutPeriod)
        {
            Alpha = 0.0f;
            updateAlpha_ = doNothing;
        }
    }
Esempio n. 18
0
 public void FadeIn()
 {
     updateAlpha_ = fadeIn;
 }
 //-------------------------------------------------------------------------
 void waitFadeIn()
 {
     if (time_ >= FadeInTime && time_ <= FadeOutTime)
     {
         Alpha = 0.0f;
         updateAlpha_ = fadeIn;
     }
 }
 //-------------------------------------------------------------------------
 //                          METHOD DEFINITIONS
 //-------------------------------------------------------------------------
 void Awake()
 {
     updateAlpha_ = waitFadeIn;
 }