private void fillField() { int i = (int)(((Boundary.Width + Boundary.Height) / 2) / (20 * Density)); do { Vector2 asteroidPos = new Vector2(rand.Next(Boundary.X, Boundary.X + Boundary.Width), rand.Next(Boundary.Y, Boundary.Y + Boundary.Height)); float asteroidSpeed = rand.NextFloat(MinSpeed, MaxSpeed); float asteroidRotation = 0.025f; Asteroids.Add(new Asteroid(asteroidPos, asteroidSpeed, asteroidRotation)); }while (--i > 0); }
private Rectangle genRandAsteroid() { return(ASTEROIDS[rand.Next(ASTEROIDS.Length)]); }