public void Max(Climate.WeatherState other) { this.Clouds = Mathf.Max(this.Clouds, other.Clouds); this.Fog = Mathf.Max(this.Fog, other.Fog); this.Wind = Mathf.Max(this.Wind, other.Wind); this.Rain = Mathf.Max(this.Rain, other.Rain); }
public static Climate.WeatherState Fade(Climate.WeatherState a, Climate.WeatherState b, float t) { Climate.WeatherState weatherState = new Climate.WeatherState() { Clouds = Mathf.SmoothStep(a.Clouds, b.Clouds, t), Fog = Mathf.SmoothStep(a.Fog, b.Fog, t), Wind = Mathf.SmoothStep(a.Wind, b.Wind, t), Rain = Mathf.SmoothStep(a.Rain, b.Rain, t) }; return(weatherState); }
private Climate.WeatherState GetWeatherState(uint seed) { object obj; object obj1; SeedRandom.Wanghash(ref seed); bool flag = SeedRandom.Value(ref seed) < this.Weather.CloudChance; bool flag1 = SeedRandom.Value(ref seed) < this.Weather.FogChance; bool flag2 = SeedRandom.Value(ref seed) < this.Weather.RainChance; bool flag3 = SeedRandom.Value(ref seed) < this.Weather.StormChance; float single = (flag ? SeedRandom.Value(ref seed) : 0f); if (flag1) { obj = 1; } else { obj = null; } float single1 = (float)obj; if (flag2) { obj1 = 1; } else { obj1 = null; } float single2 = (float)obj1; float single3 = (flag3 ? SeedRandom.Value(ref seed) : 0f); if (single2 > 0f) { single2 = Mathf.Max(single2, 0.5f); single1 = Mathf.Max(single1, single2); single = Mathf.Max(single, single2); } Climate.WeatherState weatherState = new Climate.WeatherState() { Clouds = single, Fog = single1, Wind = single3, Rain = single2 }; return(weatherState); }
protected void Update() { if (!Object.op_Implicit((Object)TerrainMeta.BiomeMap) || !Object.op_Implicit((Object)TOD_Sky.get_Instance())) { return; } TOD_Sky instance = TOD_Sky.get_Instance(); long num1 = 36000000000; long num2 = (long)World.Seed + ((TOD_CycleParameters)instance.Cycle).get_Ticks(); long num3 = 18L * num1; long num4 = 6L * num1; long num5 = num2 / num3; float t = Mathf.InverseLerp(0.0f, (float)num4, (float)(num2 % num3)); this.state = Climate.WeatherState.Fade(this.GetWeatherState((uint)((ulong)num5 % (ulong)uint.MaxValue)), this.GetWeatherState((uint)((ulong)(num5 + 1L) % (ulong)uint.MaxValue)), t); this.state.Override(this.Overrides); }
public void Override(Climate.WeatherState other) { if (other.Clouds >= 0f) { this.Clouds = Mathf.Clamp01(other.Clouds); } if (other.Fog >= 0f) { this.Fog = Mathf.Clamp01(other.Fog); } if (other.Wind >= 0f) { this.Wind = Mathf.Clamp01(other.Wind); } if (other.Rain >= 0f) { this.Rain = Mathf.Clamp01(other.Rain); } }
protected void Update() { if (!TerrainMeta.BiomeMap || !TOD_Sky.Instance) { return; } TOD_Sky instance = TOD_Sky.Instance; long num = 36000000000L; long seed = (long)((ulong)World.Seed + instance.Cycle.Ticks); long num1 = (long)18 * num; long num2 = (long)6 * num; long num3 = seed / num1; float single = Mathf.InverseLerp(0f, (float)num2, (float)(seed % num1)); Climate.WeatherState weatherState = this.GetWeatherState((uint)(num3 % (ulong)-1)); Climate.WeatherState weatherState1 = this.GetWeatherState((uint)((num3 + (long)1) % (ulong)-1)); this.state = Climate.WeatherState.Fade(weatherState, weatherState1, single); this.state.Override(this.Overrides); }
public void Override(Climate.WeatherState other) { if ((double)other.Clouds >= 0.0) { this.Clouds = Mathf.Clamp01(other.Clouds); } if ((double)other.Fog >= 0.0) { this.Fog = Mathf.Clamp01(other.Fog); } if ((double)other.Wind >= 0.0) { this.Wind = Mathf.Clamp01(other.Wind); } if ((double)other.Rain < 0.0) { return; } this.Rain = Mathf.Clamp01(other.Rain); }