public override string ToString() { string PrecipDesc = Precipitation.ToString() + " " + PrecipitationType.ToString(); if (Precipitation == GameConstants.PrecipitationLevel.None) { PrecipDesc = "None"; } string temp = string.Format( "Temp: {0}C, Clouds: {1}/8ths, {2} m/s wind from {3}, Beaufort: {4}," + " Precipitation: {5}, Sea state: {6} \nMoon phase: {7}, Is Moon Up? {8}, Sunshine: {9:F} Wm2 {10}% \n", TemperatureC, CloudCover8ths, WindSpeedMSec, WindDirectionFrom, WindForceBeaufort, PrecipDesc, SeaState, CurrentMoonPhase, IsMoonUp, SunshineWm2, SunshinePercent); string sunRiseSetDesc = string.Empty; if (IsSunRising) { sunRiseSetDesc = "Sun rising: " + SunriseTime.ToString() + " \n"; } if (IsSunSetting) { sunRiseSetDesc += "Sun setting: " + SunsetTime.ToString() + " \n "; } temp += string.Format("Sun height: {0:F} deg, Sun declination: {1:F} deg \n{2}", CurrentSunheightDeg, CurrentSunDeclinationDeg, sunRiseSetDesc); return(temp); }
public PrecipitationShaftParticleSystem(GameWidget gameWidget, SubsystemWeather subsystemWeather, Random random, Point2 point, PrecipitationType precipitationType) { m_gameWidget = gameWidget; m_subsystemWeather = subsystemWeather; m_random = random; Point = point; m_precipitationType = precipitationType; for (int i = 0; i < m_particles.Length; i++) { m_particles[i] = new Particle(); } Initialize(); }
float UpdatePrecipitation(PrecipitationType precipitationType, float currentPrecipitation) { float precipitation = 0f; if (weather.currentPrecipitationType == precipitationType) { switch (weather.currentCondition) { case WeatherCondition.LightPrecipitation: precipitation = 0.25f; break; case WeatherCondition.HeavyPrecipitation: precipitation = 1f; break; } } return(Mathf.MoveTowards( currentPrecipitation, precipitation, time.deltaTime * 10 )); }
/// <summary> /// Get the current forecast for this zone /// </summary> /// <returns>Bunch of stuff</returns> public Tuple <PrecipitationAmount, PrecipitationType, HashSet <WeatherType> > CurrentForecast() { PrecipitationAmount pAmount = PrecipitationAmount.Clear; PrecipitationType pType = PrecipitationType.Clear; HashSet <WeatherType> wTypes = new HashSet <WeatherType>(); float totalRainVolume = WeatherEvents.Where(wev => wev.Type != WeatherEventType.Tectonic).Sum(wev => wev.PrecipitationAmount); float totalStrength = WeatherEvents.Where(wev => wev.Type != WeatherEventType.Tectonic).Sum(wev => wev.Strength); if (WeatherEvents.Any(wev => wev.Type == WeatherEventType.Tectonic)) { wTypes.Add(WeatherType.Earthquake); } if (WeatherEvents.Any(wev => wev.Type == WeatherEventType.Cyclone)) { wTypes.Add(WeatherType.Tornado); } if (WeatherEvents.Any(wev => wev.Type == WeatherEventType.Typhoon)) { wTypes.Add(WeatherType.Hurricane); } if (!wTypes.Contains(WeatherType.Tornado) && !wTypes.Contains(WeatherType.Hurricane)) { if (totalStrength > 50) { wTypes.Add(WeatherType.Storming); } else if (totalStrength > 10) { wTypes.Add(WeatherType.Windy); } } if (totalRainVolume > 0) { wTypes.Add(WeatherType.Precipitation); if (totalRainVolume < 25) { pAmount = PrecipitationAmount.Drizzle; } else if (totalRainVolume < 50) { pAmount = PrecipitationAmount.Steady; } else if (totalRainVolume < 75) { pAmount = PrecipitationAmount.Downpour; } else { pAmount = PrecipitationAmount.Torrential; } int effTemp = EffectiveTemperature(); if (effTemp > 5) { pType = PrecipitationType.Rain; } else if (effTemp > -5) { pType = PrecipitationType.Snow; } else { pType = PrecipitationType.Freezing; } if (pType == PrecipitationType.Snow) { if (totalStrength <= 10) { pType = PrecipitationType.Sleet; } else if (totalStrength >= 50) { pType = PrecipitationType.Hail; } } } if (pAmount == PrecipitationAmount.Clear && pType == PrecipitationType.Clear) { wTypes.Add(WeatherType.Clear); } return(new Tuple <PrecipitationAmount, PrecipitationType, HashSet <WeatherType> >(pAmount, pType, wTypes)); }
public Precipitation(double rainfallValue, PrecipitationType precipitationType) { Value = rainfallValue; PrecipitationType = precipitationType; }