Example #1
0
        public static bool UpdateWeather(List <Unit> units, int now_clock, RandXorshift rand = null)
        {
            if (!WeatherData.mIsExecuteUpdate)
            {
                return(false);
            }
            bool            flag = false;
            WeatherSetParam currentWeatherSet = WeatherData.mCurrentWeatherSet;

            if (currentWeatherSet != null)
            {
                string iname = (string)null;
                if (WeatherData.mCurrentWeatherData == null)
                {
                    iname = currentWeatherSet.GetStartWeather(rand);
                    if (string.IsNullOrEmpty(iname))
                    {
                        return(false);
                    }
                }
                else
                {
                    int mChangeClock = (int)WeatherData.mCurrentWeatherData.mChangeClock;
                    if (mChangeClock != 0 && now_clock >= mChangeClock)
                    {
                        WeatherData.mCurrentWeatherData.mChangeClock = (OInt)currentWeatherSet.GetNextChangeClock(now_clock, rand);
                        iname = currentWeatherSet.GetChangeWeather(rand);
                    }
                }
                if (!string.IsNullOrEmpty(iname) && WeatherData.ChangeWeather(iname, units, now_clock, rand, (Unit)null, 1, 1) != null)
                {
                    flag = true;
                }
            }
            if (units != null && WeatherData.mCurrentWeatherData != null)
            {
                WeatherData currentWeatherData = WeatherData.mCurrentWeatherData;
                using (List <Unit> .Enumerator enumerator = units.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Unit current = enumerator.Current;
                        if (!current.IsGimmick && current.IsEntry && !current.IsSub)
                        {
                            currentWeatherData.attachCond(WeatherData.eCondAttachType.TURN, current, rand);
                        }
                    }
                }
            }
            return(flag);
        }