3 float m_UpdateInterval = 1.0;
4 float m_TemperatureMin = 0;
5 float m_TemperatureMax = 100;
6 float m_TemperatureCap =
float.MAX;
10 bool m_Updateable =
false;
11 bool m_ManualUpdate =
false;
12 bool m_AffectStat =
false;
18 class UniversalTemperatureSourceResult
25 class UniversalTemperatureSourceTimer :
Timer
31 GetGame().GameScript.CallFunctionParams(m_target, m_function,
null, m_params);
35 GetGame().GameScript.CallFunction(m_target, m_function,
null, 0);
45 void SetParams(
Param params)
55 protected bool m_Active
56 protected ref UniversalTemperatureSourceTimer
m_Timer;
58 protected ref UniversalTemperatureSourceResult m_ResultValues;
64 m_Settings = pSettings;
66 m_ResultValues =
new UniversalTemperatureSourceResult();
67 m_Timer =
new UniversalTemperatureSourceTimer();
78 pParent.SetUniversalTemperatureSource(
this);
80 m_Settings.m_Parent = pParent;
81 m_Settings.m_Position = pParent.GetPosition();
84 if (!m_Settings.m_ManualUpdate)
88 m_Timer.Run(m_Settings.m_UpdateInterval,
this,
"Update", params, m_Settings.m_Updateable);
95 return m_Settings.m_Position;
100 return m_Settings.m_RangeFull;
105 return m_Settings.m_RangeMax;
110 if (m_Settings.m_TemperatureCap !=
float.MAX)
112 return Math.Min(m_Settings.m_TemperatureCap, GetTemperatureRaw());
115 return GetTemperatureRaw();
118 float GetTemperatureRaw()
122 return m_ResultValues.m_Temperature;
130 return m_Settings.m_TemperatureMin;
135 return m_Settings.m_TemperatureMax;
140 return m_Settings.m_Parent;
145 if (m_Settings.m_ManualUpdate)
155 if (m_Settings.m_ManualUpdate)
161 if (pActive && !
m_Timer.IsRunning())
171 void SetDefferedActive(
bool pActive,
float pSeconds)
190 settings.m_Position = settings.m_Parent.GetUniversalTemperatureSourcePosition();
191 lambda.Execute(settings, m_ResultValues);
201 const string DELIMITER_DATA =
"|";
247 if (
m_Names.Count() - 1 < pIndex)
249 Debug.Log(
string.Format(
"GetName index: %1 from data of length: %2", pIndex,
m_Names.Count()),
"UniversalTemperatureSourceDebug");
260 Debug.Log(
string.Format(
"GetValue index: %1 from data of length: %2", pIndex,
m_Values.Count()),
"UniversalTemperatureSourceDebug");
273 m_Data.Split(DELIMITER_DATA, parsed);
286 for (
int i = 0; i <
m_Pairs.Count(); i++)
299 for (
int i = 0; i <
m_Names.Count(); i++)
301 Debug.Log(
string.Format(
"%1: %2",
m_Names.Get(i),
m_Values.Get(i)),
"UniversalTemperatureSourceDebug");