Beispiel #1
0
        public void Update(float elapsed)
        {
            if (!Inited)
            {
                return;
            }

            if (CurrentWeatherType != NextWeatherType)
            {
                CurrentWeatherChangeTime += elapsed;
                if (CurrentWeatherChangeTime >= WeatherChangeTime)
                {
                    CurrentWeatherType       = NextWeatherType;
                    CurrentWeatherChangeTime = 0.0f;
                }
                CurrentWeatherChangeBlend = Math.Min(CurrentWeatherChangeTime / WeatherChangeTime, 1.0f);
            }
            if (CurrentWeatherType != null)
            {
                CurrentWeatherRegion = CurrentWeatherType.GetRegion(Region);
            }
            if (NextWeatherType != null)
            {
                NextWeatherRegion = NextWeatherType.GetRegion(Region);
            }

            CurrentValues.Update(this);
        }
Beispiel #2
0
 public void SetNextWeather(string name)
 {
     WeatherTypes.TryGetValue(name, out NextWeatherType);
     if (NextWeatherType == null)
     {
         NextWeatherType = CurrentWeatherType;
     }
     else
     {
         CurrentWeatherChangeTime = 0.0f;
     }
 }
Beispiel #3
0
        public void Init(GameFileCache gameFileCache, Action <string> updateStatus, Timecycle timecycle)
        {
            Timecycle = timecycle;
            var rpfman = gameFileCache.RpfMan;

            //TODO: RpfMan should be able to get the right version? or maybe let gameFileCache do it!
            string filename = "common.rpf\\data\\levels\\gta5\\weather.xml";

            if (gameFileCache.EnableDlc)
            {
                filename = "update\\update.rpf\\common\\data\\levels\\gta5\\weather.xml";
            }

            XmlDocument weatherxml = rpfman.GetFileXml(filename);

            XmlElement weather = weatherxml.DocumentElement;

            XmlNodeList weathergpufx = weather.SelectNodes("WeatherGpuFx/Item");

            WeatherGpuFx.Clear();
            for (int i = 0; i < weathergpufx.Count; i++)
            {
                var weathergpufxi = new WeatherGpuFx();
                weathergpufxi.Init(weathergpufx[i]);
                WeatherGpuFx[weathergpufxi.Name] = weathergpufxi;
            }

            XmlNodeList weathertypes = weather.SelectNodes("WeatherTypes/Item");

            WeatherTypes.Clear();
            for (int i = 0; i < weathertypes.Count; i++)
            {
                var weathertype = new WeatherType();
                weathertype.Init(gameFileCache, weathertypes[i]);
                WeatherTypes[weathertype.Name] = weathertype;
            }

            XmlNodeList weathercycles = weather.SelectNodes("WeatherCycles/Item");

            WeatherCycles.Clear();
            for (int i = 0; i < weathercycles.Count; i++)
            {
                var weathercycle = new WeatherCycle();
                weathercycle.Init(weathercycles[i]);
                WeatherCycles.Add(weathercycle);
            }



            if (WeatherTypes.Count > 0)
            {
                CurrentWeatherType   = WeatherTypes.Values.First();
                CurrentWeatherRegion = CurrentWeatherType.GetRegion(Region);
                NextWeatherType      = CurrentWeatherType;
                NextWeatherRegion    = NextWeatherType.GetRegion(Region);
            }


            TimecycleMods = new TimecycleMods();
            TimecycleMods.Init(gameFileCache, updateStatus);


            Inited = true;
        }