public static void SpawnStars(int s = -1) { FastRandom withRandomSeed = FastRandom.CreateWithRandomSeed(); int num1 = withRandomSeed.Next(200, 400); int num2 = 0; int num3 = num1; if (s >= 0) { num2 = s; num3 = s + 1; } for (int index1 = num2; index1 < num3; ++index1) { Main.star[index1] = new Star(); if (s >= 0) { Main.star[index1].fadeIn = 1f; int num4 = 10; int num5 = -2000; for (int index2 = 0; index2 < num4; ++index2) { float num6 = (float)withRandomSeed.Next(1921); int num7 = 2000; for (int index3 = 0; index3 < Main.numStars; ++index3) { if (index3 != s && !Main.star[index3].hidden && !Main.star[index3].falling) { int num8 = (int)Math.Abs(num6 - Main.star[index3].position.X); if (num8 < num7) { num7 = num8; } } } if (s == 0 || num7 > num5) { num5 = num7; Main.star[index1].position.X = num6; } } } else { Main.star[index1].position.X = (float)withRandomSeed.Next(1921); } Main.star[index1].position.Y = (float)withRandomSeed.Next(1201); Main.star[index1].rotation = (float)withRandomSeed.Next(628) * 0.01f; Main.star[index1].scale = (float)withRandomSeed.Next(70, 130) * (3f / 500f); Main.star[index1].type = withRandomSeed.Next(0, 4); Main.star[index1].twinkle = (float)withRandomSeed.Next(60, 101) * 0.01f; Main.star[index1].twinkleSpeed = (float)withRandomSeed.Next(30, 110) * 0.0001f; if (withRandomSeed.Next(2) == 0) { Main.star[index1].twinkleSpeed *= -1f; } Main.star[index1].rotationSpeed = (float)withRandomSeed.Next(5, 50) * 0.0001f; if (withRandomSeed.Next(2) == 0) { Main.star[index1].rotationSpeed *= -1f; } if (withRandomSeed.Next(40) == 0) { Main.star[index1].scale *= 2f; Main.star[index1].twinkleSpeed /= 2f; Main.star[index1].rotationSpeed /= 2f; } } if (s != -1) { return; } Main.numStars = num1; }
public static void SpawnStars(int s = -1) { FastRandom fastRandom = FastRandom.CreateWithRandomSeed(); int num = fastRandom.Next(200, 400); int num2 = 0; int num3 = num; if (s >= 0) { num2 = s; num3 = s + 1; } for (int i = num2; i < num3; i++) { Main.star[i] = new Star(); if (s >= 0) { Main.star[i].fadeIn = 1f; int num4 = 10; int num5 = -2000; for (int j = 0; j < num4; j++) { float num6 = fastRandom.Next(1921); int num7 = 2000; for (int k = 0; k < Main.numStars; k++) { if (k != s && !Main.star[k].hidden && !Main.star[k].falling) { int num8 = (int)Math.Abs(num6 - Main.star[k].position.X); if (num8 < num7) { num7 = num8; } } } if (s == 0 || num7 > num5) { num5 = num7; Main.star[i].position.X = num6; } } } else { Main.star[i].position.X = fastRandom.Next(1921); } Main.star[i].position.Y = fastRandom.Next(1201); Main.star[i].rotation = (float)fastRandom.Next(628) * 0.01f; Main.star[i].scale = (float)fastRandom.Next(70, 130) * 0.006f; Main.star[i].type = fastRandom.Next(0, 4); Main.star[i].twinkle = (float)fastRandom.Next(60, 101) * 0.01f; Main.star[i].twinkleSpeed = (float)fastRandom.Next(30, 110) * 0.0001f; if (fastRandom.Next(2) == 0) { Main.star[i].twinkleSpeed *= -1f; } Main.star[i].rotationSpeed = (float)fastRandom.Next(5, 50) * 0.0001f; if (fastRandom.Next(2) == 0) { Main.star[i].rotationSpeed *= -1f; } if (fastRandom.Next(40) == 0) { Main.star[i].scale *= 2f; Main.star[i].twinkleSpeed /= 2f; Main.star[i].rotationSpeed /= 2f; } } if (s == -1) { Main.numStars = num; } }