7 [
Attribute(
"8", UIWidgets.Slider,
"Starting time of day (hours)",
"0 23 1")]
8 protected int m_iStartingHours;
10 [
Attribute(
"0", UIWidgets.Slider,
"Starting time of day (minutes)",
"0 59 1")]
16 [
Attribute(
"1", UIWidgets.Slider,
"Time acceleration during the day (1 = 100%, 2 = 200% etc)",
"0.1 12 0.1")]
19 [
Attribute(
"1", UIWidgets.Slider,
"Time acceleration during the night (1 = 100%, 2 = 200% etc)",
"0.1 12 0.1")]
28 [
Attribute(
"0",
desc:
"Scenario header setting will overwrite these values.")]
39 protected static SCR_TimeAndWeatherHandlerComponent s_Instance;
43 static SCR_TimeAndWeatherHandlerComponent
GetInstance()
54 void SetupDaytimeAndWeather(
int hours,
int minutes,
int seconds = 0,
string loadedWeatherState =
"",
bool loadDone =
false)
65 TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
69 float sunrise, morning, evening, sunset;
72 if (manager.GetSunriseHour(sunrise))
74 manager.GetSunsetHour(sunset);
85 morning = sunrise + 0.25;
86 float noon = (sunrise + sunset) * 0.5;
87 float afternoon = (noon + sunset) * 0.5;
88 evening = sunset - 0.5;
89 float night = noon + 12;
94 array<float> startingTimes = {morning, noon, afternoon, evening, night};
101 if (startingTimes.IsIndexValid(
index))
102 startingTime = startingTimes[
index];
104 startingTime = startingTimes.GetRandomElement();
106 manager.TimeToHoursMinutesSeconds(startingTime, hours, minutes, seconds);
111 array<ref WeatherState> weatherStates = {};
112 manager.GetWeatherStatesList(weatherStates);
114 if (!weatherStates.IsEmpty())
121 if (!loadedWeatherState.IsEmpty())
124 manager.SetHoursMinutesSeconds(hours, minutes, seconds);
143 TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
147 if (manager.IsNightHour(manager.GetTimeOfTheDay()))
168 super.OnWorldPostProcess(world);
170 if (!Replication.IsServer() || !
GetGame().InPlayMode())
173 if (s_Instance !=
this)
175 Print(
"Multiple instances of SCR_TimeAndWeatherHandlerComponent detected.", LogLevel.WARNING);
186 if (s_Instance || !
GetGame().InPlayMode())
190 #ifdef TDM_CLI_SELECTION
196 if (!Replication.IsServer())
203 m_iStartingHours = header.m_iStartingHours;