DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BleedingDrop.c
См. документацию.
1
3{
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; //remaining duration AFTER breakpoint
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;
14
15 protected float m_ColorAlphaStart;
16 protected float m_ColorAlphaEnd;
17 protected float m_ColorAlphaCurrent;
18
19 protected float m_ImageBaseSizeX;
20 protected float m_ImageBaseSizeY;
21 protected float m_ImageStartingSizeX; //adjusted by percentage
22 protected float m_ImageStartingSizeY; //adjusted by percentage
23 protected float m_ImageEndSizeX; //adjusted by percentage
24 protected float m_ImageEndSizeY; //adjusted by percentage
25 protected float m_ImageMaxSizeX;
26 protected float m_ImageMaxSizeY;
27 protected float m_ImageBaseRotation;
28 protected bool m_IsRunning;
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;
37
38 //Written with relative positioning in mind
39 void BleedingIndicatorDropData(ImageWidget image, int severity)
40 {
41 m_Widget = image;
42 m_Severity = severity;
43 m_TimeTotal = 0;
44 m_IsRunning = false;
45
46#ifdef DIAG_DEVELOPER
48 {
58 }
59 else
60#endif
61 {
62 switch (m_Severity)
63 {
65 {
73 break;
74 }
76 {
84 break;
85 }
87 {
95 break;
96 }
97 }
98
101 }
103
104 m_SpeedCoef = 1.0; //TODO ??
105#ifdef DIAG_DEVELOPER
107 {
110 }
111 else
112#endif
113 {
116 }
120 }
121
123 {
124 }
125
126 protected void InitImageScale()
127 {
130
132 m_ImageEndSizeX = m_ImageBaseSizeX * m_EndSizeCoef * randomScaleCoef;
134 m_ImageEndSizeY = m_ImageBaseSizeY * m_EndSizeCoef * randomScaleCoef;
135 }
136
138 {
139#ifdef DIAG_DEVELOPER
141 {
143 }
144#endif
145 float rndRadius = Math.RandomFloatInclusive(0.0,m_ScatterPx);
146 float rndPos = Math.RandomFloatInclusive(0.0,Math.PI2);
147 m_PosX = pos[0];
148 m_PosX = m_PosX + rndRadius * Math.Sin(rndPos);
149
150 m_PosY = pos[1];
151 m_PosY = m_PosY + rndRadius * Math.Cos(rndPos);
152 }
153
155 {
156 m_TimeTotal = 0;
157
159 m_Widget.SetPos(m_PosX,m_PosY);
160#ifdef DIAG_DEVELOPER
162 {
163 m_Widget.SetRotation(0,0,0);
164 }
165 else
166#endif
167 {
168 m_Widget.SetRotation(0,0,Math.RandomFloatInclusive(0.0,360.0));
169 }
170
171 m_Widget.Show(true);
172 m_IsRunning = true;
173 }
174
175 void StopDrop()
176 {
177 m_IsRunning = false;
178 m_Widget.SetSize(m_ImageBaseSizeX,m_ImageBaseSizeY); //resets image size
179 m_Widget.Show(false);
180 }
181
188
190 {
191 return m_IsRunning;
192 }
193
194 ImageWidget GetImage()
195 {
196 return m_Widget;
197 }
198
200 {
201 //color adjustment
206#ifdef DIAG_DEVELOPER
208 {
213 }
214#endif
215
216 //saturation adjustment
217#ifdef DIAG_DEVELOPER
219 {
220#endif
221 Param par = PPEManagerStatic.GetPPEManager().GetPostProcessCurrentValues(PostProcessEffectType.Glow,PPEGlow.PARAM_SATURATION);
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
230 }
231#endif
232
233 int color = ARGB(0x00,r,g,b);
234 m_Widget.SetColor(color);
235 }
236
237 void UpdateAlpha(float progress,float progressFade)
238 {
239 if (progress <= m_ProgressBreakpoint)
240 {
242 }
243 else
244 {
246 }
247
249 }
250
252 void UpdateTransform(float progress, float progressFade)
253 {
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);
258
259 if (progress <= m_ProgressBreakpoint)
260 {
261 //do stuff before breakpoint
262 }
263 else
264 {
265 //do stuff after breakpoint
266 float posYTemp = Math.Lerp(m_PosY,m_PosY + m_SlideDistance, progressFade);
267 m_Widget.SetPos(m_PosX,posYTemp);
268 }
269 }
270
271 void Update(float timeSlice)
272 {
273 if (m_IsRunning)
274 {
275 float progress, progressFade;
276 progress = m_TimeTotal / m_Duration;
278
279 //alpha
280 UpdateAlpha(progress,progressFade);
281 //transform + scaling
282 UpdateTransform(progress,progressFade);
283
284 m_TimeTotal += (timeSlice * m_SpeedCoef);
285
286 if (m_TimeTotal >= m_Duration)
287 {
288 //deletes this;
289 StopDrop();
290 }
291 }
292 }
293}
static const float DROP_SIZE_END_MEDIUM
Определения BleedingIndicationConstants.c:43
static const float DROP_DURATION_MEDIUM
Определения BleedingIndicationConstants.c:39
static const int DROP_COLOR_RED
Определения BleedingIndicationConstants.c:15
static const float DROP_SIZE_VARIATION_MAX_MEDIUM
Определения BleedingIndicationConstants.c:45
static const float DROP_SIZE_VARIATION_MAX_HIGH
Определения BleedingIndicationConstants.c:58
static const float DROP_SIZE_START_MEDIUM
Определения BleedingIndicationConstants.c:42
static const float DROP_SIZE_VARIATION_MIN_MEDIUM
Определения BleedingIndicationConstants.c:44
static const float DROP_SIZE_VARIATION_MIN_LOW
Определения BleedingIndicationConstants.c:31
static const float DROP_SIZE_VARIATION_MIN_HIGH
Определения BleedingIndicationConstants.c:57
static const float DROP_SIZE_START_LOW
Определения BleedingIndicationConstants.c:29
static const int DROP_SCATTER_LOW
Определения BleedingIndicationConstants.c:33
static const int DROP_COLOR_ALPHA_END
Определения BleedingIndicationConstants.c:19
static const int DROP_SCATTER_MEDIUM
Определения BleedingIndicationConstants.c:46
static const int INDICATOR_SEVERITY_MEDIUM
Определения BleedingIndicationConstants.c:6
static const float DROP_SIZE_START_HIGH
Определения BleedingIndicationConstants.c:55
static const int DROP_COLOR_ALPHA_START
Определения BleedingIndicationConstants.c:18
static const float DROP_SIZE_END_HIGH
Определения BleedingIndicationConstants.c:56
static const int DROP_COLOR_BLUE
Определения BleedingIndicationConstants.c:17
static const float DROP_PROGRESS_THRESHOLD
Определения BleedingIndicationConstants.c:13
static const int DROP_SCATTER_HIGH
Определения BleedingIndicationConstants.c:59
static const float DROP_DURATION_HIGH
Определения BleedingIndicationConstants.c:52
static const float DROP_SIZE_VARIATION_MAX_LOW
Определения BleedingIndicationConstants.c:32
static const int DROP_COLOR_GREEN
Определения BleedingIndicationConstants.c:16
static const float DROP_COLOR_DESATURATIONEND
Определения BleedingIndicationConstants.c:14
static const float DROP_SIZE_END_LOW
Определения BleedingIndicationConstants.c:30
static const float DROP_DURATION_LOW
Определения BleedingIndicationConstants.c:26
static const float DROP_SLIDE_DISTANCE_LOW
Определения BleedingIndicationConstants.c:34
static const float DROP_SLIDE_DISTANCE_HIGH
Определения BleedingIndicationConstants.c:60
static const int INDICATOR_SEVERITY_LOW
Определения BleedingIndicationConstants.c:5
static const float DROP_SLIDE_DISTANCE_MEDIUM
Определения BleedingIndicationConstants.c:47
static const int INDICATOR_SEVERITY_HIGH
Определения BleedingIndicationConstants.c:7
float m_StartSizeCoef
Определения BleedingDrop.c:33
float m_ColorAlphaEnd
Определения BleedingDrop.c:16
void InitImageScale()
Определения BleedingDrop.c:126
float m_RandomSizeMin
Определения BleedingDrop.c:35
void StartDrop()
Определения BleedingDrop.c:154
float m_ImageBaseSizeY
Определения BleedingDrop.c:20
int m_ScreenSizeX
Определения BleedingDrop.c:30
ImageWidget m_Widget
Определения BleedingDrop.c:4
float m_ImageStartingSizeY
Определения BleedingDrop.c:22
vector m_BasePosition
Определения BleedingDrop.c:29
float m_ImageEndSizeY
Определения BleedingDrop.c:24
float m_ColorAlphaCurrent
Определения BleedingDrop.c:17
float m_PosY
Определения BleedingDrop.c:32
int m_Severity
Определения BleedingDrop.c:5
void ~BleedingIndicatorDropData()
Определения BleedingDrop.c:122
float m_PosX
Определения BleedingDrop.c:32
void BleedingIndicatorDropData(ImageWidget image, int severity)
Определения BleedingDrop.c:39
float m_RandomSizeMax
Определения BleedingDrop.c:36
float m_ImageBaseSizeX
Определения BleedingDrop.c:19
void Update(float timeSlice)
Определения BleedingDrop.c:271
float m_ImageEndSizeX
Определения BleedingDrop.c:23
float m_EndSizeCoef
Определения BleedingDrop.c:34
int m_ScreenSizeY
Определения BleedingDrop.c:31
ImageWidget GetImage()
Определения BleedingDrop.c:194
float m_Duration
Определения BleedingDrop.c:10
int m_ScatterPx
Определения BleedingDrop.c:12
float m_ImageMaxSizeX
Определения BleedingDrop.c:25
bool m_IsRunning
Определения BleedingDrop.c:28
bool IsRunning()
Определения BleedingDrop.c:189
void SetBasePosition(vector pos)
Определения BleedingDrop.c:182
float m_ColorAlphaStart
Определения BleedingDrop.c:15
void StopDrop()
Определения BleedingDrop.c:175
float m_ImageBaseRotation
Определения BleedingDrop.c:27
void UpdateAlpha(float progress, float progressFade)
Определения BleedingDrop.c:237
float m_TimeTotal
Определения BleedingDrop.c:6
float m_ProgressFadingDuration
Определения BleedingDrop.c:8
float m_ProgressBreakpointTime
Определения BleedingDrop.c:7
void ScatterPosition(vector pos)
Определения BleedingDrop.c:137
float m_ProgressBreakpoint
Определения BleedingDrop.c:9
float m_SpeedCoef
Определения BleedingDrop.c:11
float m_ImageStartingSizeX
Определения BleedingDrop.c:21
void AdjustColorSaturation()
Определения BleedingDrop.c:199
float m_SlideDistance
Определения BleedingDrop.c:13
void UpdateTransform(float progress, float progressFade)
scaling and transformation
Определения BleedingDrop.c:252
float m_ImageMaxSizeY
Определения BleedingDrop.c:26
static float m_DbgDropProgressTreshold
Определения BleedingIndicationStaticInfo.c:11
static float m_DbgDropSizeVariationMax
Определения BleedingIndicationStaticInfo.c:15
static float m_DbgDropSizeVariationMin
Определения BleedingIndicationStaticInfo.c:14
static info (non-constants)
Определения BleedingIndicationStaticInfo.c:3
static float EaseOutSine(float t)
Определения Easing.c:9
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Определения Easing.c:3
Определения EnMath.c:7
static const int PARAM_SATURATION
Определения PPEGlow.c:31
Glow - PostProcessEffectType.Glow.
Определения PPEGlow.c:8
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Определения PPEManager.c:27
Static component of PPE manager, used to hold the instance.
Определения PPEManager.c:3
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения EnConvert.c:106
PostProcessEffectType
Post-process effect type.
Определения EnWorld.c:72
static const float PI2
Определения EnMath.c:13
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:106
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
proto void GetScreenSize(out int x, out int y)
int ARGB(int a, int r, int g, int b)
Определения proto.c:322