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

◆ CalcBaseEnvironmentTemperature()

float WorldData::CalcBaseEnvironmentTemperature ( float monthday,
float daytime )
inlineprotected

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

134 {
135 float approxSunrise = GetApproxSunriseTime( monthday );
136 float approxSunset = GetApproxSunsetTime( monthday );
137 float dayLight = approxSunset - approxSunrise;
138 float nightTime = 24.0 - dayLight;
139 int tempArrayIndex = Math.Floor(monthday) - 1;
140 int tempArrayIndexToLerp = tempArrayIndex + 1;
141 if ( tempArrayIndexToLerp >= 12 )
142 tempArrayIndexToLerp = 0;
143 float tempArrayLerp = monthday - Math.Floor(monthday);
144 float minTempA = m_MinTemps[tempArrayIndex];
145 float minTempB = m_MinTemps[tempArrayIndexToLerp];
146 float maxTempA = m_MaxTemps[tempArrayIndex];
147 float maxTempB = m_MaxTemps[tempArrayIndexToLerp];
148 float eveningMinA = minTempA + ( 0.5 * Math.AbsFloat( minTempA - maxTempA ) );
149 float eveningMinB = minTempB + ( 0.5 * Math.AbsFloat( minTempB - maxTempB ) );
150
151 if ( ( daytime >= approxSunrise ) && ( daytime <= approxSunset ) ) {
152 if ( daytime <= ( approxSunrise + ( dayLight * 0.75 ) ) )
153 return Math.Lerp(
154 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
155 Math.Lerp( maxTempA, maxTempB, tempArrayLerp ),
156 ( ( daytime - approxSunrise ) / ( dayLight * 0.75 ) ) );
157 else
158 return Math.Lerp(
159 Math.Lerp( maxTempA, maxTempB, tempArrayLerp ),
160 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
161 ( ( ( daytime - approxSunrise ) - ( dayLight * 0.75 ) ) / ( dayLight - ( dayLight * 0.75 ) ) ) );
162 } else {
163 if ( ( daytime > approxSunset ) && ( daytime < 24 ) )
164 return Math.Lerp(
165 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
166 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
167 ( ( daytime - approxSunset ) / ( 24 - approxSunset ) ) / 2.0 );
168 else
169 return Math.Lerp(
170 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
171 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
172 ( ( ( daytime + ( 24 - approxSunset ) ) / nightTime ) / 2.0 ) + 0.5 );
173 }
174 }
float GetApproxSunriseTime(float monthday)
Определения WorldData.c:99
float GetApproxSunsetTime(float monthday)
Определения WorldData.c:106
float m_MaxTemps[12]
Определения WorldData.c:23
float m_MinTemps[12]
Определения WorldData.c:24

Перекрестные ссылки Math::AbsFloat(), Math::Floor(), GetApproxSunriseTime(), GetApproxSunsetTime(), Math::Lerp(), m_MaxTemps и m_MinTemps.

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