public static List <Storm> CreateForecast(DateTime date, BoundingBox bounds, WorldManager world, int days) { List <Storm> foreCast = new List <Storm>(); for (int i = 0; i < days; i++) { // Each day, a storm could originate from a randomly selected biome Vector3 randomSample = MathFunctions.RandVector3Box(bounds); float rain = Overworld.GetValueAt(randomSample, Overworld.ScalarFieldType.Rainfall, world.WorldScale, world.WorldOrigin); float temperature = Overworld.GetValueAt(randomSample, Overworld.ScalarFieldType.Temperature, world.WorldScale, world.WorldOrigin); // Generate storms according to the rainfall in the biome. Up to 4 storms per day. int numStorms = (int)MathFunctions.Rand(0, rain * 4); // Space out the storms by a few hours int stormHour = MathFunctions.RandInt(0, 6); for (int j = 0; j < numStorms; j++) { bool isSnow = MathFunctions.RandEvent(1.0f - temperature); Storm storm = new Storm(world) { WindSpeed = MathFunctions.RandVector3Cube() * 5, Intensity = MathFunctions.Rand(rain, rain * 2), Date = date + new TimeSpan(i, stormHour, 0, 0), TypeofStorm = isSnow ? StormType.SnowStorm : StormType.RainStorm }; storm.WindSpeed = new Vector3(storm.WindSpeed.X, 0, storm.WindSpeed.Z); stormHour += MathFunctions.RandInt(1, 12); foreCast.Add(storm); } } return(foreCast); }