コード例 #1
0
ファイル: Weather.cs プロジェクト: rt-2/CodeWalker
        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);
        }
コード例 #2
0
ファイル: Weather.cs プロジェクト: rt-2/CodeWalker
 public void Init(XmlNode node)
 {
     //read cycle node
     Name        = Xml.GetStringAttribute(node, "name");
     RegionCount = Xml.GetIntAttribute(node, "regions");
     Regions     = new Dictionary <string, WeatherCycleKeyframeRegion>();
     foreach (XmlNode child in node.ChildNodes)
     {
         WeatherCycleKeyframeRegion r = new WeatherCycleKeyframeRegion();
         r.Init(child);
         Regions[r.Name] = r;
     }
 }
コード例 #3
0
ファイル: Weather.cs プロジェクト: rt-2/CodeWalker
        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;
        }