DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
HeatComfortAnimHandler.c
См. документацию.
2{
3 const float TICK_INTERVAL = 2;
4
9
11
12 float m_EventTimeFreezeRattle = -1; // -1 = symptom effect needs to be triggered for first time
13 float m_EventTimeFreeze = -1;
14 float m_EventTimeHot = -1;
15
17
18 const float TIME_INTERVAL_HC_MINUS_LOW_MIN = 12; // Freezing and rattle symptoms interval minimum, lerped according to heat confort
20
21 const float TIME_INTERVAL_HC_MINUS_LOW_MAX = 20; // Interval maximum, lerped according to heat confort
23
24 const float TIME_INTERVAL_HC_PLUS_LOW_MIN = 12; // Ditto for heat symptoms
26
29
31 {
32 m_Player = player;
33 }
34
35 void Update(float delta_time, HumanMovementState hms)
36 {
37 m_TimeSinceLastTick += delta_time;
38
40 {
41 if (g_Game.IsServer())
43
45 }
46 }
47
48 void Process(float delta_time)
49 {
50 float hc = m_Player.GetStatHeatComfort().Get();
51
53 {
54 m_ProcessTimeAccuHot += delta_time;
55
57 ProcessHot(hc);
58 }
60 {
61 // White zone, reset the timers
62
63 if (m_EventTimeHot > -1 && hc <= 0)
64 m_EventTimeHot = -1;
65
66 if (m_EventTimeFreeze > -1 && hc >= 0)
68
71
72 }
73 else if (hc <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING) // Light blue zone
74 {
75 if (hc <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL) // Deep blue blinking zone, rattling is layerd on top of freezing
76 {
78
81 }
82
83 m_ProcessTimeAccuFreeze += delta_time;
84
86 ProcessFreeze(hc);
87 }
88
89 // Debug.Log("HeatComfort: " + hc);
90 }
91
92 private void ProcessHot(float hcValue)
93 {
94 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_HOT);
97
98 // Debug.Log("HeatComfort: " + hcValue + ", HOT in: " + m_EventTimeHot + "s");
99 }
100
101 private void ProcessFreeze(float hcValue)
102 {
103 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_FREEZE);
106
107 // Debug.Log("HeatComfort: " + hcValue + ", FREEZE in: " + m_EventTimeFreeze + "s");
108 }
109
110 private void ProcessFreezeRattle(float hcValue)
111 {
112 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_FREEZE_RATTLE);
115
116 // Debug.Log("HeatComfort: " + hcValue + ", RATTLE in: " + m_EventTimeFreezeRattle + "s");
117 }
118
119 private float GetEventTime(float hcValue, float threshold_low, float thresholdHigh, float lowMin, float highMin, float lowMax, float highMax)
120 {
121 float inv_value = Math.Clamp(Math.InverseLerp(threshold_low, thresholdHigh, hcValue), 0, 1);
122 float valueMin = Math.Lerp(lowMin, highMin, inv_value);
123 float value_max = Math.Lerp(lowMax, highMax, inv_value);
124
125 return Math.RandomFloatInclusive(valueMin, value_max);
126 }
127}
DayZGame g_Game
Определения DayZGame.c:3942
void Process()
Определения EffectManager.c:743
void ProcessFreeze(float hcValue)
Определения HeatComfortAnimHandler.c:101
float m_ProcessTimeAccuHot
Определения HeatComfortAnimHandler.c:8
void Update(float delta_time, HumanMovementState hms)
Определения HeatComfortAnimHandler.c:35
ref HumanMovementState m_MovementState
Определения HeatComfortAnimHandler.c:16
float m_ProcessTimeAccuFreeze
Определения HeatComfortAnimHandler.c:6
float m_ProcessTimeAccuFreezeRattle
Определения HeatComfortAnimHandler.c:7
void ProcessFreezeRattle(float hcValue)
Определения HeatComfortAnimHandler.c:110
float m_EventTimeFreeze
Определения HeatComfortAnimHandler.c:13
void Process(float delta_time)
Определения HeatComfortAnimHandler.c:48
const float TIME_INTERVAL_HC_MINUS_HIGH_MAX
Определения HeatComfortAnimHandler.c:22
float m_TimeSinceLastTick
Определения HeatComfortAnimHandler.c:5
float GetEventTime(float hcValue, float threshold_low, float thresholdHigh, float lowMin, float highMin, float lowMax, float highMax)
Определения HeatComfortAnimHandler.c:119
const float TIME_INTERVAL_HC_PLUS_HIGH_MIN
Определения HeatComfortAnimHandler.c:25
const float TIME_INTERVAL_HC_MINUS_LOW_MIN
Определения HeatComfortAnimHandler.c:18
const float TIME_INTERVAL_HC_PLUS_LOW_MAX
Определения HeatComfortAnimHandler.c:27
const float TIME_INTERVAL_HC_PLUS_LOW_MIN
Определения HeatComfortAnimHandler.c:24
const float TIME_INTERVAL_HC_MINUS_HIGH_MIN
Определения HeatComfortAnimHandler.c:19
const float TIME_INTERVAL_HC_MINUS_LOW_MAX
Определения HeatComfortAnimHandler.c:21
void HeatComfortAnimHandler(PlayerBase player)
Определения HeatComfortAnimHandler.c:30
const float TIME_INTERVAL_HC_PLUS_HIGH_MAX
Определения HeatComfortAnimHandler.c:28
void ProcessHot(float hcValue)
Определения HeatComfortAnimHandler.c:92
const float TICK_INTERVAL
Определения HeatComfortAnimHandler.c:3
PlayerBase m_Player
Определения HeatComfortAnimHandler.c:10
float m_EventTimeFreezeRattle
Определения HeatComfortAnimHandler.c:12
Определения human.c:1154
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
Определения PlayerConstants.c:92
static const float THRESHOLD_HEAT_COMFORT_PLUS_WARNING
Определения PlayerConstants.c:88
static const float THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL
Определения PlayerConstants.c:93
static const float THRESHOLD_HEAT_COMFORT_PLUS_EMPTY
Определения PlayerConstants.c:90
static const float THRESHOLD_HEAT_COMFORT_MINUS_EMPTY
Определения PlayerConstants.c:94
Определения PlayerConstants.c:2
static proto bool IsInRange(float v, float min, float max)
Returns if value is between min and max (inclusive)
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 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 InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...