4 protected ImageWidget m_Widget;
5 protected int m_Severity;
6 protected float m_TimeTotal;
7 protected float m_ProgressBreakpointTime;
8 protected float m_ProgressFadingDuration;
9 protected float m_ProgressBreakpoint;
10 protected float m_Duration;
11 protected float m_SpeedCoef;
12 protected int m_ScatterPx;
13 protected float m_SlideDistance;
15 protected float m_ColorAlphaStart;
16 protected float m_ColorAlphaEnd;
17 protected float m_ColorAlphaCurrent;
19 protected float m_ImageBaseSizeX;
20 protected float m_ImageBaseSizeY;
21 protected float m_ImageStartingSizeX;
22 protected float m_ImageStartingSizeY;
23 protected float m_ImageEndSizeX;
24 protected float m_ImageEndSizeY;
25 protected float m_ImageMaxSizeX;
26 protected float m_ImageMaxSizeY;
27 protected float m_ImageBaseRotation;
28 protected bool m_IsRunning;
29 protected vector m_BasePosition;
30 protected int m_ScreenSizeX;
31 protected int m_ScreenSizeY;
32 protected float m_PosX, m_PosY;
33 protected float m_StartSizeCoef;
34 protected float m_EndSizeCoef;
35 protected float m_RandomSizeMin;
36 protected float m_RandomSizeMax;
42 m_Severity = severity;
102 m_ProgressFadingDuration =
Math.Max(0.0001,
m_Duration - m_ProgressBreakpointTime);
105 #ifdef DIAG_DEVELOPER
119 AdjustColorSaturation();
126 protected void InitImageScale()
128 m_Widget.GetSize(m_ImageBaseSizeX,m_ImageBaseSizeY);
129 float randomScaleCoef =
Math.RandomFloatInclusive(m_RandomSizeMin,m_RandomSizeMax);
131 m_ImageStartingSizeX = m_ImageBaseSizeX * m_StartSizeCoef * randomScaleCoef;
132 m_ImageEndSizeX = m_ImageBaseSizeX * m_EndSizeCoef * randomScaleCoef;
133 m_ImageStartingSizeY = m_ImageBaseSizeY * m_StartSizeCoef * randomScaleCoef;
134 m_ImageEndSizeY = m_ImageBaseSizeY * m_EndSizeCoef * randomScaleCoef;
137 void ScatterPosition(
vector pos)
139 #ifdef DIAG_DEVELOPER
145 float rndRadius =
Math.RandomFloatInclusive(0.0,m_ScatterPx);
146 float rndPos =
Math.RandomFloatInclusive(0.0,
Math.PI2);
148 m_PosX = m_PosX + rndRadius *
Math.Sin(rndPos);
151 m_PosY = m_PosY + rndRadius *
Math.Cos(rndPos);
158 ScatterPosition(m_BasePosition);
159 m_Widget.SetPos(m_PosX,m_PosY);
160 #ifdef DIAG_DEVELOPER
163 m_Widget.SetRotation(0,0,0);
168 m_Widget.SetRotation(0,0,
Math.RandomFloatInclusive(0.0,360.0));
178 m_Widget.SetSize(m_ImageBaseSizeX,m_ImageBaseSizeY);
179 m_Widget.Show(
false);
182 void SetBasePosition(
vector pos)
184 m_BasePosition = pos;
185 m_BasePosition[0] = m_BasePosition[0] - m_ScreenSizeX/2;
186 m_BasePosition[1] = m_BasePosition[1] - m_ScreenSizeY/2;
194 ImageWidget GetImage()
199 void AdjustColorSaturation()
206 #ifdef DIAG_DEVELOPER
217 #ifdef DIAG_DEVELOPER
222 float saturationProgress = Param1<float>.Cast(par).param1;
223 saturationProgress =
Easing.EaseOutSine(saturationProgress);
224 saturationProgress =
Math.Lerp(desaturationEnd,1.0,saturationProgress);
225 float lowest_channel =
Math.Min(
Math.Min(r,g),b);
226 r =
Math.Lerp(lowest_channel,r,saturationProgress);
227 g =
Math.Lerp(lowest_channel,g,saturationProgress);
228 b =
Math.Lerp(lowest_channel,b,saturationProgress);
229 #ifdef DIAG_DEVELOPER
233 int color =
ARGB(0x00,r,g,b);
234 m_Widget.SetColor(color);
237 void UpdateAlpha(
float progress,
float progressFade)
239 if (progress <= m_ProgressBreakpoint)
241 m_ColorAlphaCurrent = m_ColorAlphaStart;
245 m_ColorAlphaCurrent =
Math.Lerp(m_ColorAlphaStart,m_ColorAlphaEnd,progressFade);
248 m_Widget.SetAlpha(m_ColorAlphaCurrent);
252 void UpdateTransform(
float progress,
float progressFade)
254 float breakProgress =
Math.Clamp(
Math.InverseLerp(0.0,m_ProgressBreakpoint,progress),0,1);
255 float sizeX =
Math.Lerp(m_ImageStartingSizeX,m_ImageEndSizeX,breakProgress);
256 float sizeY =
Math.Lerp(m_ImageStartingSizeY,m_ImageEndSizeY,breakProgress);
257 m_Widget.SetSize(sizeX,sizeY);
259 if (progress <= m_ProgressBreakpoint)
266 float posYTemp =
Math.Lerp(m_PosY,m_PosY + m_SlideDistance, progressFade);
267 m_Widget.SetPos(m_PosX,posYTemp);
271 void Update(
float timeSlice)
275 float progress, progressFade;
277 progressFade = (m_TimeTotal - m_ProgressBreakpointTime) / m_ProgressFadingDuration;
280 UpdateAlpha(progress,progressFade);
282 UpdateTransform(progress,progressFade);
284 m_TimeTotal += (timeSlice * m_SpeedCoef);