5 protected float m_AccumulatedTime = 0;
6 protected bool m_FadeIn =
false;
7 protected bool m_FadeOut =
false;
9 const float FADE_TIME = 3;
11 const float R_TARGET = 0.60;
12 const float G_TARGET = 0.28;
13 const float B_TARGET = 0.07;
19 m_AccumulatedTime = 0;
28 override protected void OnUpdate(
float delta )
30 super.OnUpdate( delta );
32 if ( m_FadeIn && m_AccumulatedTime <= FADE_TIME )
34 m_AccumulatedTime += delta;
36 m_StartRGB[0] = 1 - FadeColourMult( 0, 1, m_AccumulatedTime / FADE_TIME ) * R_TARGET;
37 m_StartRGB[1] = 1 - FadeColourMult( 0, 1, m_AccumulatedTime / FADE_TIME ) * G_TARGET;
38 m_StartRGB[2] = 1 - FadeColourMult( 0, 1, m_AccumulatedTime / FADE_TIME ) * B_TARGET;
45 if (m_AccumulatedTime <= FADE_TIME)
47 m_AccumulatedTime += delta;
49 m_StartRGB[0] = ( 1 - R_TARGET ) + FadeColourMult( 0, R_TARGET, m_AccumulatedTime / FADE_TIME );
50 m_StartRGB[1] = ( 1 - G_TARGET ) + FadeColourMult( 0, G_TARGET, m_AccumulatedTime / FADE_TIME );
51 m_StartRGB[2] = ( 1 - B_TARGET ) + FadeColourMult( 0, B_TARGET, m_AccumulatedTime / FADE_TIME );
68 if (par &&
Class.CastTo(p,par))
71 m_AccumulatedTime = 0;
77 protected float FadeColourMult(
float x,
float y,
float deltaT )
80 output =
Math.Lerp(
x,
y, deltaT );
81 Easing.EaseInOutSine( output );