public WeatherOverlay(World world, WeatherOverlayInfo info) { this.info = info; this.world = world; currentWindIndex = info.WindLevels.Length / 2; targetWindXOffset = info.WindLevels[0]; maxParticleCount = CalculateParticleCount(Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height); }
public WeatherOverlay(World world, WeatherOverlayInfo info) { this.info = info; this.world = world; targetWindStrengthIndex = info.ChangingWindLevel ? world.LocalRandom.Next(info.WindLevels.Length) : 0; windUpdateCountdown = world.LocalRandom.Next(info.WindTick[0], info.WindTick[1]); windStrength = info.WindLevels[targetWindStrengthIndex]; }
public Particle(WeatherOverlayInfo info, MersenneTwister r, Rectangle viewport) { var x = r.Next(viewport.Left, viewport.Right); var y = r.Next(viewport.Top, viewport.Bottom); Pos = new int2(x, y); Size = r.Next(info.ParticleSize[0], info.ParticleSize[1] + 1); DirectionScatterX = info.ScatterDirection[0] + r.Next(info.ScatterDirection[1] - info.ScatterDirection[0]); Gravity = float2.Lerp(info.Gravity[0], info.Gravity[1], r.NextFloat()); SwingOffset = float2.Lerp(info.SwingOffset[0], info.SwingOffset[1], r.NextFloat()); SwingSpeed = float2.Lerp(info.SwingSpeed[0], info.SwingSpeed[1], r.NextFloat()); SwingDirection = r.Next(2) == 0 ? 1 : -1; SwingAmplitude = float2.Lerp(info.SwingAmplitude[0], info.SwingAmplitude[1], r.NextFloat()); Color = info.ParticleColors.Random(r); TailColor = Color.FromArgb(info.LineTailAlphaValue, Color.R, Color.G, Color.B); }