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

Защищенные члены

void IngameHudHeatBuffer (Widget root, notnull PlayerBase player)
 
void OnPlayerNegativeCondition (PlayerBase player)
 
void OnPlayerConditionChanged (PlayerBase player)
 
bool CanUpdate ()
 
void Update (float timeslice)
 
void SetBaseAlpha (Widget hbw, float valuePercent, float stageThreshold)
 
void UpdateEffect (Widget hbw, float duration, float timeslice)
 

Защищенные данные

Widget m_Root
 
float m_CurrentValue
 
bool m_IsActive
 
int m_CurrentDirection
 
int m_PreviousDirection
 
bool m_Update
 
PlayerBase m_Player
 
float m_EffectTime
 
float m_EffectDuration
 
bool m_FadeIn
 
float m_FlashingTime
 
int m_FlashingStage
 
ref map< int, floatm_FlashingThresholds
 

Подробное описание

Конструктор(ы)

◆ IngameHudHeatBuffer()

void IngameHudHeatBuffer ( Widget root,
notnull PlayerBase player )
inlineprotected
20 {
21 m_Root = root;
23
24 player.GetOnDeathStart().Insert(OnPlayerNegativeCondition);
25 player.GetOnUnconsciousStart().Insert(OnPlayerNegativeCondition);
26 player.GetOnUnconsciousStop().Insert(OnPlayerConditionChanged);
27
30 m_Update = true;
31 m_FlashingStage = -1;
32
34 m_FlashingThresholds.Insert(1, 0.002);
35 m_FlashingThresholds.Insert(2, 0.332);
36 m_FlashingThresholds.Insert(3, 0.662);
37 }
Widget m_Root
Definition IngameHudHeatBuffer.c:4
ref map< int, float > m_FlashingThresholds
Definition IngameHudHeatBuffer.c:17
void OnPlayerNegativeCondition(PlayerBase player)
Definition IngameHudHeatBuffer.c:39
PlayerBase m_Player
Definition IngameHudHeatBuffer.c:11
int m_PreviousDirection
Definition IngameHudHeatBuffer.c:9
int m_FlashingStage
Definition IngameHudHeatBuffer.c:16
void OnPlayerConditionChanged(PlayerBase player)
Definition IngameHudHeatBuffer.c:49
int m_CurrentDirection
Definition IngameHudHeatBuffer.c:8
bool m_Update
Definition IngameHudHeatBuffer.c:10
Definition EntityAI.c:95

Перекрестные ссылки m_CurrentDirection, m_FlashingStage, m_FlashingThresholds, m_Player, m_PreviousDirection, m_Root, m_Update, OnPlayerConditionChanged() и OnPlayerNegativeCondition().

Методы

◆ CanUpdate()

bool CanUpdate ( )
inlineprotected
60 {
61 return m_Player && m_Update;
62 }

Перекрестные ссылки m_Player и m_Update.

◆ OnPlayerConditionChanged()

void OnPlayerConditionChanged ( PlayerBase player)
inlineprotected
50 {
51 #ifdef HEATBUFFER_INDICATOR_DEBUG
52 Print("IngameHudHeatBuffer::OnPlayerConditionChanged");
53 #endif
54
55 if (player == m_Player)
56 m_Update = true;
57 }
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки m_Player, m_Update и Print().

Используется в IngameHudHeatBuffer().

◆ OnPlayerNegativeCondition()

void OnPlayerNegativeCondition ( PlayerBase player)
inlineprotected
40 {
41 #ifdef HEATBUFFER_INDICATOR_DEBUG
42 Print("IngameHudHeatBuffer::OnPlayerNegativeCondition");
43 #endif
44
45 if (player == m_Player)
46 m_Update = false;
47 }

Перекрестные ссылки m_Player, m_Update и Print().

Используется в IngameHudHeatBuffer().

◆ SetBaseAlpha()

void SetBaseAlpha ( Widget hbw,
float valuePercent,
float stageThreshold )
inlineprotected
242 {
243 float baseAlpha = Math.Lerp(0.05, 1.00, (valuePercent / stageThreshold));
244 baseAlpha = Math.Floor(baseAlpha * 100) / 100;
245
246 #ifdef HEATBUFFER_INDICATOR_DEBUG
247 Print("HEAT BUFFER - Set base alpha=" + baseAlpha + " | Widget=" + hbw.GetName());
248 #endif
249
250 hbw.SetAlpha(baseAlpha); // Set the current alpha to the base alpha
251 }
Definition EnMath.c:7
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки Math::Floor(), Math::Lerp() и Print().

Используется в Update().

◆ Update()

void Update ( float timeslice)
inlineprotected
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 //heatBufferPercent = Math.Floor(heatBufferPercent * 100) * 0.01; // Buff value percentage with micro optimization
73
74 #ifdef HEATBUFFER_INDICATOR_DEBUG
75 Print("-----------------------------------------------------------------------");
76 Print("Buff stage=" + heatBufferStage);
77 Print("Buff value=" + heatBufferVal);
78 Print("Buff percent=" + heatBufferPercent);
79 Print("Buff dynamic max=" + heatBufferDynMax);
80 Print("Effect active=" + m_IsActive);
81 Print("Last buff value=" + m_CurrentValue);
82 Print("Buff differance=" + heatBufferDiff);
83 Print("Prev Heat buffer direction=" + m_PreviousDirection);
84 Print("Flashing time=" + m_FlashingTime);
85 Print("Flashing stage=" + m_FlashingStage);
86 #endif
87
88 for (int i = 1; i < HeatBufferMdfr.NUMBER_OF_STAGES; ++i)
89 {
90 Widget hbw = m_Root.FindAnyWidget("HeatBuffer" + i);
92
93 #ifdef HEATBUFFER_INDICATOR_DEBUG
94 Print("Stage treshold=" + stageThreshold);
95 #endif
96
97 // Determine heat buffer direction.
98 // When heat buffer percentage value is higher the the heat buffer dynamic max value we prevent increasing for the indactor logic.
99 // Heat buffer Dynamic max value determines the max value the character can currently reach with his current heat insolation
100 if (heatBufferDiff > 0)
101 {
102 // If heat buffer percentage value is below or at current heat buffer dynamic max range value the direction cant change
104 {
106 }
107 else
108 {
109 #ifdef HEATBUFFER_INDICATOR_DEBUG
110 Print("HEAT BUFFER - DYNAMIC MAX REACHED - DONT CHANGE DIRECTION");
111 #endif
113 }
114 }
115 else if (heatBufferDiff < 0)
116 {
118 }
119
120 #ifdef HEATBUFFER_INDICATOR_DEBUG
121 Print("Heat buffer direction=" + m_CurrentDirection);
122 #endif
123
124 // Hide visibility of flashing stages
126 {
127 if (m_FlashingStage == i)
128 {
129 m_IsActive = false;
130 m_FlashingTime = 0;
131 m_FlashingStage = -1;
132 }
133
134 hbw.SetAlpha(0);
135 hbw.Show(false);
136 }
137
138 // Handle widget visibility and alpha based on stage and buffer percent
139 if (heatBufferStage >= i)
140 {
141 hbw.Show(true);
142
144 {
145 if (m_CurrentDirection == 1)
146 {
147 #ifdef HEATBUFFER_INDICATOR_DEBUG
148 Print("HEAT BUFFER - STAGE " + i + " - INCREASING");
149 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 220, 220, 0)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
150 #endif
151
153
155 {
156 m_IsActive = false;
157 m_FlashingTime = 0;
158 m_FlashingStage = -1;
159 }
160
162 }
163 else if (m_CurrentDirection == 0)
164 {
165 #ifdef HEATBUFFER_IND ICATOR_DEBUG
166 Print("HEAT BUFFER - STAGE " + i + " - DECREASING");
167 #endif
168
170
172 {
173 m_IsActive = false;
174 }
175
177 if (heatBufferDynMax < 0.5)
178 {
180 }
181
182 #ifdef HEATBUFFER_INDICATOR_DEBUG
183 Print("HEAT BUFFER - STAGE " + i + " - DECREASING - Flashing threshold=" + flashingThreshold);
184 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 0, 206, 209)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
185 #endif
186
188 {
189 #ifdef HEATBUFFER_INDICATOR_DEBUG
190 Print("HEAT BUFFER - STAGE " + i + " - FLASHING");
191 #endif
192
193 if (m_FlashingStage == i && m_FlashingTime <= 3.0)
195
196 #ifdef HEATBUFFER_INDICATOR_DEBUG
197 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 255, 0, 0)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
198 #endif
199
200 UpdateEffect(hbw, 0.25, timeslice);
201
203 if (m_FlashingTime >= 3.0)
204 {
205 m_IsActive = false;
206 m_FlashingTime = 0;
207 m_FlashingStage = -1;
208 hbw.SetAlpha(0);
209 hbw.Show(false);
210 }
211 }
212 }
213 else if (m_CurrentDirection == -1)
214 {
215 #ifdef HEATBUFFER_INDICATOR_DEBUG
216 Print("HEAT BUFFER - STAGE " + i + " - STAL");
217 #endif
218
220 }
221 }
222 else
223 {
224 #ifdef HEATBUFFER_INDICATOR_DEBUG
225 Print("HEAT BUFFER - STAGE " + i + " - MAXED");
226 #endif
227
228 hbw.SetAlpha(1.0);
229 #ifdef HEATBUFFER_INDICATOR_DEBUG
230 hbw.SetColor(ARGB(hbw.GetAlpha() * 255, 220, 220, 220)); // COLOR SET ON INDICATOR IS ONLY HERE FOR DEBUG TESTING FOR NOW
231 #endif
232 }
233 }
234 }
235
238 }
Definition HeatBuffer.c:2
const float STAGE_THRESHOLDS[NUMBER_OF_STAGES]
Definition HeatBuffer.c:4
const int NUMBER_OF_STAGES
Definition HeatBuffer.c:3
void SetBaseAlpha(Widget hbw, float valuePercent, float stageThreshold)
Definition IngameHudHeatBuffer.c:241
bool m_IsActive
Definition IngameHudHeatBuffer.c:7
void UpdateEffect(Widget hbw, float duration, float timeslice)
Definition IngameHudHeatBuffer.c:253
float m_FlashingTime
Definition IngameHudHeatBuffer.c:15
float m_CurrentValue
Definition IngameHudHeatBuffer.c:6
Definition EnWidgets.c:190
int ARGB(int a, int r, int g, int b)
Definition 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().

◆ UpdateEffect()

void UpdateEffect ( Widget hbw,
float duration,
float timeslice )
inlineprotected
254 {
255 #ifdef HEATBUFFER_INDICATOR_DEBUG
256 Print("HEAT BUFFER - EFFECT - Widget=" + hbw.GetName());
257 #endif
258
259 float baseAlpha = hbw.GetAlpha();
260 float opacity;
261
262 // Initialize the effect if it's not already active
263 if (!m_IsActive)
264 {
266 m_EffectTime = 0;
267 m_FadeIn = true;
268 m_IsActive = true;
269 }
270
271 // Update the effect time
273
274 // Calculate the time fraction
276
277 // Calculate opacity
278 if (m_FadeIn)
279 {
280 opacity = Math.Lerp(0.0, 1.0, timeFraction);
281 if (timeFraction >= 1.0)
282 {
283 m_FadeIn = false;
284 m_EffectTime = 0; // Reset for fade-out
285 }
286 }
287 else
288 {
289 opacity = Math.Lerp(1.0, 0.0, timeFraction);
290 if (timeFraction >= 1.0)
291 {
292 m_FadeIn = true;
293 m_EffectTime = 0; // Reset for fade-in
294 }
295 }
296
297 // Clamp the opacity to ensure it's within the valid range
298 opacity = Math.Clamp(opacity, 0.0, 1.0);
299
300 // Set the widget's alpha (opacity)
301 hbw.SetAlpha(opacity);
302
303 // Debug print statements
304 #ifdef HEATBUFFER_INDICATOR_DEBUG
305 Print("HEAT BUFFER - EFFECT - Opacity=" + opacity + " | Time Fraction=" + timeFraction + " | FadeIn=" + m_FadeIn + " | Effect time=" + m_EffectTime + " | Effect duration=" + m_EffectDuration);
306 #endif
307 }
float m_EffectTime
Definition IngameHudHeatBuffer.c:12
bool m_FadeIn
Definition IngameHudHeatBuffer.c:14
float m_EffectDuration
Definition IngameHudHeatBuffer.c:13
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'.

Перекрестные ссылки Math::Clamp(), Math::Lerp(), m_EffectDuration, m_EffectTime, m_FadeIn, m_IsActive и Print().

Используется в Update().

Поля

◆ m_CurrentDirection

int m_CurrentDirection
protected

Используется в IngameHudHeatBuffer() и Update().

◆ m_CurrentValue

float m_CurrentValue
protected

Используется в Update().

◆ m_EffectDuration

float m_EffectDuration
protected

Используется в UpdateEffect().

◆ m_EffectTime

float m_EffectTime
protected

Используется в UpdateEffect().

◆ m_FadeIn

bool m_FadeIn
protected

Используется в UpdateEffect().

◆ m_FlashingStage

int m_FlashingStage
protected

Используется в IngameHudHeatBuffer() и Update().

◆ m_FlashingThresholds

ref map<int, float> m_FlashingThresholds
protected

Используется в IngameHudHeatBuffer() и Update().

◆ m_FlashingTime

float m_FlashingTime
protected

Используется в Update().

◆ m_IsActive

bool m_IsActive
protected

Используется в Update() и UpdateEffect().

◆ m_Player

◆ m_PreviousDirection

int m_PreviousDirection
protected

Используется в IngameHudHeatBuffer() и Update().

◆ m_Root

Widget m_Root
protected

Используется в IngameHudHeatBuffer() и Update().

◆ m_Update


Объявления и описания членов класса находятся в файле: