public BackgroundParticle(BackgroundParticleSettings bps, Vector2 screenSize) { Random random = GraphicsHelper.Random; initialPosition = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * screenSize; amplitude = (float)random.NextDouble() * screenSize.Y / 2; speed = ((float)random.NextDouble() + 1) / 100; period = (float)random.NextDouble() / screenSize.X * MathHelper.TwoPi; phase = (float)random.NextDouble() * MathHelper.TwoPi; timePhase = (float)random.NextDouble() * MathHelper.TwoPi; this.screenSize = screenSize; rotationRate = bps.RandomRotationRate() * (random.Next(0, 2) * 2 - 1); rotation = (float)random.NextDouble() * MathHelper.TwoPi; scale = bps.RandomScale(); color = bps.RandomColor(); time = 0; }
public BackgroundParticleSet(AssetManager assets, Vector2 screenSize, int actNumber) { BackgroundParticleSettings bps = new BackgroundParticleSettings(assets, actNumber); this.texture = bps.Texture; distance = bps.Distance; particles = new BackgroundParticle[bps.NumParticles]; for (int i = 0; i < particles.Length; i++) particles[i] = new BackgroundParticle(bps, screenSize); frames = 0; }