Exemple #1
0
        private void SpawnEnemies()
        {
            switch (activeEvent)
            {
            case Events.None:
                if (random.Next(1, 300) == 1)
                {
                    float spawnPosX = random.Next(25, desiredResolutionWidth - 25);
                    float spawnPosY = -50;
                    UFO.NewUFO(new Vector2(spawnPosX, spawnPosY));
                }
                if (random.Next(1, 380) == 1)
                {
                    float spawnPosX = random.Next(25, desiredResolutionWidth - 25);
                    float spawnPosY = -50;
                    Slicer.NewSlicer(new Vector2(spawnPosX, spawnPosY));
                }
                if (random.Next(1, 720) == 1)
                {
                    float spawnPosX = random.Next(8, desiredResolutionWidth - 8);
                    float spawnPosY = -50;
                    RayEnemy.NewRay(new Vector2(spawnPosX, spawnPosY));
                }
                if (random.Next(1, 720) == 1)
                {
                    float spawnPosX = random.Next(16, desiredResolutionWidth - 16);
                    float spawnPosY = -50;
                    Stasis.NewStasis(new Vector2(spawnPosX, spawnPosY));
                }
                break;

            case Events.AsteroidField:
                if (random.Next(1, 120) == 1)
                {
                    int   asteroidType      = random.Next(0, 4 + 1);
                    float asteroidSpawnPosX = random.Next(24, desiredResolutionWidth - 24);
                    float asteroidSpawnPosY = -50;
                    float asteroidFallSpeed = (float)random.NextDouble() * 0.2f;
                    float asteroidScale     = (float)(random.Next(80, 100 + 1)) / 100f;
                    float asteroidRotation  = (float)(random.Next(10, 100 + 1) / 2000f);
                    Asteroid.NewAsteroid(asteroidType, new Vector2(asteroidSpawnPosX, asteroidSpawnPosY), new Vector2(0f, asteroidFallSpeed / (1.1f - (asteroidScale / 100f))), asteroidRotation, asteroidScale);
                }
                break;
            }
        }