/// <summary> /// Updates the text display /// </summary> private void Update() { Vector2 windInstance, windTracked; float intensity; float temp; float hum; WeatherTypes weatherType; Vector2 location = new Vector2(trackedTransform.position.x, trackedTransform.position.z); windInstance = weatherManager.GetWindValueAt(location); windTracked = weatherManager.GetCumulativeWind(); intensity = weatherManager.GetIntensityValueAt(location); temp = weatherManager.GetTemperatureValueAt(location); TemperatureVariables tempEnum = temp.ToTemperatureValue(); hum = weatherManager.GetHumidityValueAt(location); HumidityVariables humEnum = hum.ToHumidityValue(); weatherType = weatherManager.GetWeather(location); Output("Wind:", new object[] { windInstance, windTracked }, windOutput); Output("Intensity:", new object[] { intensity }, intensityOutput); Output("Temp:", new object[] { tempEnum, temp }, tempOutput); Output("Hum:", new object[] { humEnum, hum }, humOutput); Output("Weather:", new object[] { weatherType }, weatherTypeOutput); }
/// <summary> /// Get the weather for a particular time and place /// </summary> /// <param name="weatherQueryLocation">The position at which to get the weather</param> /// <param name="time">The time at which the weather should be queried</param> /// <returns>The WeatherTypes for that position at that time and updates the the tracked X and Y values</returns> private WeatherTypes GetWeatherProcedural(Vector2 weatherQueryLocation, float time, bool updateTrackedValues = true) { TemperatureVariables temperature = GetTemperatureValueAt(weatherQueryLocation).ToTemperatureValue(); HumidityVariables humidity = GetHumidityValueAt(weatherQueryLocation).ToHumidityValue(); Vector2 wind = GetWindValueAt(weatherQueryLocation); if (updateTrackedValues) { temperatureLastFrame = temperature; humidityLastFrame = humidity; trackedX += wind.x; trackedY += wind.y; } WeatherTypes currentWeather; if (proceduralWeatherLookup.LookupTable.TryGetValue(humidity, temperature, out currentWeather)) { return(currentWeather); } else { Debug.LogError("Procedural lookup table does not contain info for " + humidity + " and " + temperature); return(WeatherTypes.None); } }
private void LogWeatherData() { Vector2 windInstance, windTracked; float intensity; float temp; float hum; WeatherTypes weatherType; Vector2 location = new Vector2(trackedTransform.position.x, trackedTransform.position.z); weatherType = weatherManager.GetWeather(location); windInstance = weatherManager.GetWindValueAt(location); windTracked = weatherManager.GetCumulativeWind(); intensity = weatherManager.GetIntensityValueAt(location); temp = weatherManager.GetTemperatureValueAt(location); TemperatureVariables tempEnum = temp.ToTemperatureValue(); hum = weatherManager.GetHumidityValueAt(location); HumidityVariables humEnum = hum.ToHumidityValue(); float time = Time.timeSinceLevelLoad; AddToLog(ToCSV(new object[] { time, weatherType, humEnum, hum, tempEnum, temp, intensity, windInstance, windTracked })); }
public IntensityData(float intensity, TemperatureVariables temperature, HumidityVariables humidity, Vector2 wind, WeatherTypes weatherType) { this.intensity = intensity; this.temperature = temperature; this.humidity = humidity; this.wind = wind; this.weatherType = weatherType; }
/// <summary> /// Get the current weather type for manual mode /// </summary> /// <param name="updateTrackedValues">Should any tracked values be updated (ie. the humidtyLastFrame and temperatureLastFrame values?</param> /// <returns>The current weather type</returns> private WeatherTypes GetWeatherManual(bool updateTrackedValues = true) { if (updateTrackedValues) { KeyValuePair <HumidityVariables, TemperatureVariables> humityTemperaturePair; //Using the type of the current weather event, reverse lookup what temperature and humidity would cause that weather in procedural mode if (proceduralWeatherLookup.LookupTable.TryReverseLookup(manualEventsSequence[eventSequenceIndex].weatherEvent.WeatherType, out humityTemperaturePair) == false) { Debug.LogError("Cannot reverse lookup weather event (" + manualEventsSequence[eventSequenceIndex].weatherEvent.name + "). Ensure weather lookup property is assigned correctly. temperature and humidity values will be incorrect."); } else { humidityLastFrame = humityTemperaturePair.Key; temperatureLastFrame = humityTemperaturePair.Value; } } return(manualEventsSequence[eventSequenceIndex].weatherEvent.WeatherType); }
public TemperatureHumidityPair(TemperatureVariables temperature, HumidityVariables humidity) { this.temperature = temperature; this.humidity = humidity; }