public static PrimitiveFirework getNew() { Vector2 position; position.X = rand.Next(creationOffset, (int)Game1.windowSize.X - creationOffset - 450); position.Y = Game1.windowSize.Y - 1; float speed = (float)(rand.NextDouble() * maxMinusMinSpeed + minSpeed); float angle = (float)(-Math.PI / 2 + (rand.NextDouble() - .5) * angleMaxDev); ColorConversion.ColorHSL newColor = new ColorConversion.ColorHSL(); newColor.H = rand.Next(360); newColor.L = .5f; newColor.S = 1f; Color color = ColorConversion.ColorConversion.HSLtoRGB(newColor); //new Color(rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255), 255); int points = pointsMin + rand.Next(pointsAdd); PrimitiveFirework firework = new PrimitiveFirework(position, angle, speed, color, points); firework.scale = new Vector2(.6f); return firework; }
public static RotatingFirework getNew() { Vector2 position; position.X = rand.Next(creationOffset, (int)Game1.windowSize.X - creationOffset - 450); position.Y = Game1.windowSize.Y - 1; float speed = (float)(rand.NextDouble() * maxMinusMinSpeed + minSpeed); float angle = (float)(-Math.PI / 2 + (rand.NextDouble() - .5) * angleMaxDev); ColorConversion.ColorHSL newColor = new ColorConversion.ColorHSL(); newColor.H = rand.Next(360); newColor.L = .5f; newColor.S = 1f; Color color = ColorConversion.ColorConversion.HSLtoRGB(newColor); //new Color(rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255), 255); int points = pointsMin + rand.Next(pointsAdd); float newUpForse = .00005f * Mass / speed; float newAngleSpeed = (4f + (float)rand.NextDouble()) / 5000 / speed; if (rand.Next(0, 1) == 0) newAngleSpeed *= -1; RotatingFirework firework = new RotatingFirework(position, angle, speed, color, points, newUpForse, ((float)rand.NextDouble() - .5f) / 10000); firework.scale = new Vector2(.6f, .8f); return firework; }