3 const float TICK_INTERVAL = 2;
4 float m_TimeSinceLastTick;
5 float m_ProcessTimeAccuFreeze;
6 float m_ProcessTimeAccuHot;
9 float m_EventTimeFreeze = -1;
10 float m_EventTimeHot = -1;
13 const float TIME_INTERVAL_HC_MINUS_LOW_MIN = 5;
const float TIME_INTERVAL_HC_MINUS_LOW_MAX = 12;
14 const float TIME_INTERVAL_HC_MINUS_HIGH_MIN = 15;
const float TIME_INTERVAL_HC_MINUS_HIGH_MAX = 25;
16 const float TIME_INTERVAL_HC_PLUS_LOW_MIN = 5;
const float TIME_INTERVAL_HC_PLUS_LOW_MAX = 12;
17 const float TIME_INTERVAL_HC_PLUS_HIGH_MIN = 15;
const float TIME_INTERVAL_HC_PLUS_HIGH_MAX = 25;
35 float GetEventTime(
float hc_value ,
float threshold_low,
float threshold_high,
float low_min,
float high_min,
float low_max,
float high_max)
37 float inv_value =
Math.InverseLerp(threshold_low, threshold_high, hc_value);
38 float value_min =
Math.Lerp(low_min, high_min,inv_value);
39 float value_max =
Math.Lerp(low_max,high_max,inv_value);
41 return Math.RandomFloatInclusive(value_min,value_max);
45 void Process(
float delta_time)
50 float hc =
m_Player.GetStatHeatComfort().Get();
58 m_ProcessTimeAccuFreeze++;
60 if(m_EventTimeFreeze < 0)
62 m_EventTimeFreeze = GetEventTime(hc,
PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_EMPTY,
PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING, TIME_INTERVAL_HC_MINUS_LOW_MIN, TIME_INTERVAL_HC_MINUS_HIGH_MIN, TIME_INTERVAL_HC_MINUS_LOW_MAX, TIME_INTERVAL_HC_MINUS_HIGH_MAX);
65 if( m_ProcessTimeAccuFreeze > m_EventTimeFreeze )
67 m_ProcessTimeAccuFreeze = 0;
68 m_EventTimeFreeze = -1;
69 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_FREEZE);
82 m_ProcessTimeAccuHot++;
84 if(m_EventTimeHot < 0)
86 m_EventTimeHot = GetEventTime(hc,
PlayerConstants.THRESHOLD_HEAT_COMFORT_PLUS_EMPTY,
PlayerConstants.THRESHOLD_HEAT_COMFORT_PLUS_WARNING, TIME_INTERVAL_HC_PLUS_LOW_MIN, TIME_INTERVAL_HC_PLUS_LOW_MIN, TIME_INTERVAL_HC_PLUS_LOW_MAX, TIME_INTERVAL_HC_PLUS_HIGH_MAX);
89 if( m_ProcessTimeAccuHot > m_EventTimeHot )
91 m_ProcessTimeAccuHot = 0;
93 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_HOT);