Show / Hide Table of Contents

Class WeatherClimateSeason

The weather odds for one climate and season.

Inheritance
Object
WeatherClimateSeason
Namespace: DaggerfallWorkshop.Game.Weather
Assembly: Assembly-CSharp.dll
Syntax
[Serializable]
public class WeatherClimateSeason

Constructors

| Improve this Doc View Source

WeatherClimateSeason()

Declaration
public WeatherClimateSeason()

Fields

| Improve this Doc View Source

Cloudy

Declaration
public float Cloudy
Field Value
Type Description
Single
| Improve this Doc View Source

Fog

Declaration
public float Fog
Field Value
Type Description
Single
| Improve this Doc View Source

Overcast

Declaration
public float Overcast
Field Value
Type Description
Single
| Improve this Doc View Source

Rain

Declaration
public float Rain
Field Value
Type Description
Single
| Improve this Doc View Source

Snow

Declaration
public float Snow
Field Value
Type Description
Single
| Improve this Doc View Source

Sunny

Declaration
public float Sunny
Field Value
Type Description
Single
| Improve this Doc View Source

Thunder

Declaration
public float Thunder
Field Value
Type Description
Single

Methods

| Improve this Doc View Source

CompileOdds()

Compiles the odds into a sorted list for optimized look ups during weather forecasting.

Declaration
public void CompileOdds()
| Improve this Doc View Source

GetWeather()

Get the next randomly chosen weather.

The brute force way to compute this is to create an N-element array with the weather types and pick a random index. N is 100/min_precision. For us, min_precision is 1% and N is 100.

This uses a cumulative distribution list of weather chances. Generates a random value and iterate across until we find a >= cumulative probability. This cuts down the list to the number of weather types (7).

This isn't critical since both methods are constant time and the weather logic is infrequent. But oh well!

Declaration
public WeatherType GetWeather()
Returns
Type Description
WeatherType

Next weather pattern to move towards.

| Improve this Doc View Source

ToString()

Makes a pretty formatted string with all weather odds.

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • WeatherClimateSeason()
  • Fields
    • Cloudy
    • Fog
    • Overcast
    • Rain
    • Snow
    • Sunny
    • Thunder
  • Methods
    • CompileOdds()
    • GetWeather()
    • ToString()
Back to top Generated by DocFX