private WeatherPreset GetWeatherPreset(uint seed, WeatherPresetType type) { if (presetLookup == null) { presetLookup = new Dictionary <WeatherPresetType, WeatherPreset[]>(); } WeatherPreset[] value; if (!presetLookup.TryGetValue(type, out value)) { presetLookup.Add(type, value = CacheWeatherPresets(type)); } return(ArrayEx.GetRandom(value, ref seed)); }
public WeatherPreset[] CacheWeatherPresets(WeatherPresetType type) { return(WeatherPresets.Where((WeatherPreset x) => x.Type == type).ToArray()); }