DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Update()

void IngameHudHeatBuffer::Update ( float timeslice)
inlineprotected

См. определение в файле IngameHudHeatBuffer.c строка 64

65 {
66 int heatBufferStage = m_Player.GetHeatBufferStage();
67 float heatBufferVal = m_Player.GetStatHeatBuffer().Get();
68 float heatBufferDynMax = m_Player.GetHeatBufferDynamicMax();
69 float heatBufferPercent = heatBufferVal / m_Player.GetStatHeatBuffer().GetMax();
70 float heatBufferDiff = heatBufferVal - m_CurrentValue;
71 m_CurrentValue = heatBufferVal;
72
73 #ifdef HEATBUFFER_INDICATOR_DEBUG
74 Print("-----------------------------------------------------------------------");
75 Print("Buff stage=" + heatBufferStage);
76 Print("Buff value=" + heatBufferVal);
77 Print("Buff percent=" + heatBufferPercent);
78 Print("Buff dynamic max=" + heatBufferDynMax);
79 Print("Effect active=" + m_IsActive);
80 Print("Last buff value=" + m_CurrentValue);
81 Print("Buff differance=" + heatBufferDiff);
82 Print("Prev Heat buffer direction=" + m_PreviousDirection);
83 Print("Flashing time=" + m_FlashingTime);
84 Print("Flashing stage=" + m_FlashingStage);
85 #endif
86
87 for (int i = 1; i < HeatBufferMdfr.NUMBER_OF_STAGES; ++i)
88 {
89 Widget hbw = m_Root.FindAnyWidget("HeatBuffer" + i);
90 if (!hbw)
91 continue;
92
93 float stageThreshold = HeatBufferMdfr.STAGE_THRESHOLDS[i];
94 #ifdef HEATBUFFER_INDICATOR_DEBUG
95 Print("Stage treshold=" + stageThreshold);
96 #endif
97
98 // Determine heat buffer direction.
99 // When heat buffer percentage value is higher the the heat buffer dynamic max value we prevent increasing for the indactor logic.
100 // Heat buffer Dynamic max value determines the max value the character can currently reach with his current heat insolation
101 if (heatBufferDiff > 0)
102 {
103 // If heat buffer percentage value is below or at current heat buffer dynamic max range value the direction cant change
104 if (heatBufferPercent < heatBufferDynMax)
105 {
107 }
108 else
109 {
110 #ifdef HEATBUFFER_INDICATOR_DEBUG
111 Print("HEAT BUFFER - DYNAMIC MAX REACHED - DONT CHANGE DIRECTION");
112 #endif
114 }
115 }
116 else if (heatBufferDiff < 0)
117 {
119 }
120
121 #ifdef HEATBUFFER_INDICATOR_DEBUG
122 Print("Heat buffer direction=" + m_CurrentDirection);
123 #endif
124
125 // Hide visibility of flashing stages
126 if (heatBufferStage < i && m_FlashingStage != i || m_FlashingStage == i && m_FlashingTime >= 2.9)
127 {
128 if (m_FlashingStage == i)
129 {
130 m_IsActive = false;
131 m_FlashingTime = 0;
132 m_FlashingStage = -1;
133 }
134
135 hbw.SetAlpha(0);
136 hbw.Show(false);
137 }
138
139 // Handle widget visibility and alpha based on stage and buffer percent
140 if (heatBufferStage >= i)
141 {
142 hbw.Show(true);
143
144 if (heatBufferPercent < stageThreshold)
145 {
146 if (m_CurrentDirection == 1)
147 {
148 #ifdef HEATBUFFER_INDICATOR_DEBUG
149 Print("HEAT BUFFER - STAGE " + i + " - INCREASING");
150 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 220, 220, 0)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
151 #endif
152
153 SetBaseAlpha(hbw, heatBufferPercent, stageThreshold);
154
156 {
157 m_IsActive = false;
158 m_FlashingTime = 0;
159 m_FlashingStage = -1;
160 }
161
162 UpdateEffect(hbw, 2.0, timeslice);
163 }
164 else if (m_CurrentDirection == 0)
165 {
166 #ifdef HEATBUFFER_IND ICATOR_DEBUG
167 Print("HEAT BUFFER - STAGE " + i + " - DECREASING");
168 #endif
169
170 SetBaseAlpha(hbw, heatBufferPercent, stageThreshold);
171
173 {
174 m_IsActive = false;
175 }
176
177 float flashingThreshold = m_FlashingThresholds.Get(i);
178 if (heatBufferDynMax < 0.5)
179 {
180 flashingThreshold = flashingThreshold + 0.002;
181 }
182
183 #ifdef HEATBUFFER_INDICATOR_DEBUG
184 Print("HEAT BUFFER - STAGE " + i + " - DECREASING - Flashing threshold=" + flashingThreshold);
185 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 0, 206, 209)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
186 #endif
187
188 if (heatBufferPercent <= flashingThreshold)
189 {
190 #ifdef HEATBUFFER_INDICATOR_DEBUG
191 Print("HEAT BUFFER - STAGE " + i + " - FLASHING");
192 #endif
193
194 #ifdef HEATBUFFER_INDICATOR_DEBUG
195 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 255, 0, 0)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
196 #endif
197
198 UpdateEffect(hbw, 0.25, timeslice);
199
200 m_FlashingTime += timeslice;
201 if (m_FlashingTime >= 2.9)
202 {
203 m_IsActive = false;
204 m_FlashingTime = 0;
205 m_FlashingStage = -1;
206 hbw.SetAlpha(0);
207 hbw.Show(false);
208 }
209 }
210 }
211 else if (m_CurrentDirection == -1)
212 {
213 #ifdef HEATBUFFER_INDICATOR_DEBUG
214 Print("HEAT BUFFER - STAGE " + i + " - STAL");
215 #endif
216
217 SetBaseAlpha(hbw, heatBufferPercent, stageThreshold);
218 }
219 }
220 else
221 {
222 #ifdef HEATBUFFER_INDICATOR_DEBUG
223 Print("HEAT BUFFER - STAGE " + i + " - MAXED");
224 #endif
225
226 hbw.SetAlpha(1.0);
227 #ifdef HEATBUFFER_INDICATOR_DEBUG
228 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 220, 220, 220)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
229 #endif
230 }
231 }
232 }
233
236 }
void UpdateEffect(Widget hbw, float duration, float timeslice)
Определения IngameHudHeatBuffer.c:251
float m_FlashingTime
Определения IngameHudHeatBuffer.c:15
int m_PreviousDirection
Определения IngameHudHeatBuffer.c:9
int m_FlashingStage
Определения IngameHudHeatBuffer.c:16
PlayerBase m_Player
Определения IngameHudHeatBuffer.c:11
int m_CurrentDirection
Определения IngameHudHeatBuffer.c:8
void SetBaseAlpha(Widget hbw, float valuePercent, float stageThreshold)
Определения IngameHudHeatBuffer.c:239
Widget m_Root
Определения IngameHudHeatBuffer.c:4
ref map< int, float > m_FlashingThresholds
Определения IngameHudHeatBuffer.c:17
bool m_IsActive
Определения IngameHudHeatBuffer.c:7
float m_CurrentValue
Определения IngameHudHeatBuffer.c:6
proto void Print(void var)
Prints content of variable to console/log.
WorkspaceWidget Widget
Defined in code.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322

Перекрестные ссылки ARGB(), m_CurrentDirection, m_CurrentValue, m_FlashingStage, m_FlashingThresholds, m_FlashingTime, m_IsActive, m_Player, m_PreviousDirection, m_Root, HeatBufferMdfr::NUMBER_OF_STAGES, Print(), SetBaseAlpha(), HeatBufferMdfr::STAGE_THRESHOLDS и UpdateEffect().