Esempio n. 1
0
        public void SummonEnemy()
        {
            Random rand = new Random();
            Enemy enemy = null;
            Point point;

            // Get the number of legitimate spawn points on the map and store it
            int normalSpawns = GameScene.CurrentMap.SpawnPoints.Count;

            // Roll between 0 and 4 to determine the enemy spawned
            switch (rand.Next(0,5))
            {
                case 0:
                    enemy = new LimeyLemon();
                    break;
                case 1:
                    enemy = new MoroseMushroom();
                    break;
                case 2:
                    enemy = new BadBanana();
                    break;
                case 3:
                    enemy = new SmellyLettuce();
                    break;
                case 4:
                    enemy = new AngryApple();
                    break;
                default:
                    break;
            }

            int rolledPoint = rand.Next(0, normalSpawns + 1);
            if (rolledPoint < normalSpawns)
            {
                point = GameScene.CurrentMap.SpawnPoints[rolledPoint];
            }
            else
            {
                point = MapPosition;
            }
            WaveManager.QueuedSpawns.Add(new WaveManager.QueuedSpawn(enemy, point));
            //WaveManager.SpawnAt(enemy, point);
            //Play a cool graphic here
        }
Esempio n. 2
0
        public void SpawnEnemy()
        {
            if (EnemiesLeft <= 0)
            {
                NextWave();
                return;
            }
            else
            {
                //Minus one enemy left.
                EnemiesLeft--;

                Enemy newEnemy;
                switch (WaveNumber)
                {
                    case (1):
                        //WavePaused = true;
                        //EnemiesLeft = 0;
                        //newEnemy = new AlexanderHamilton();
                        //break;
                        newEnemy = new CruelCarrot();
                        break;
                    case (2):
                        newEnemy = new GrumpyGrape();
                        break;
                    case (3):
                        newEnemy = new EvilOrange();
                        break;
                    case (4):
                        newEnemy = new BadBanana();
                        break;
                    case (5):
                        newEnemy = new MoroseMushroom();
                        break;
                    case (6):
                        newEnemy = new PoopyPotato();
                        break;
                    case (7):
                        newEnemy = new AngryApple();
                        break;
                    case (8):
                        newEnemy = new GhostFruit();
                        break;
                    case (9):
                        newEnemy = new CarnivorousCorn();
                        break;
                    case (10):
                        newEnemy = new SmellyLettuce();
                        break;
                    case (11):
                        newEnemy = new LimeyLemon();
                        break;
                    case (12):
                        WavePaused = true;
                        EnemiesLeft = 0;
                        newEnemy = new WizardPear();
                        break;
                    case (13):
                        newEnemy = new CruelCarrot(true);
                        break;
                    case (14):
                        newEnemy = new GrumpyGrape(true);
                        break;
                    case (15):
                        newEnemy = new EvilOrange(true);
                        break;
                    case (16):
                        newEnemy = new BadBanana(true);
                        break;
                    case (17):
                        newEnemy = new MoroseMushroom(true);
                        break;
                    case (18):
                        newEnemy = new PoopyPotato(true);
                        break;
                    case (19):
                        newEnemy = new AngryApple(true);
                        break;
                    case (20):
                        newEnemy = new GhostFruit(true);
                        break;
                    case (21):
                        newEnemy = new CarnivorousCorn(true);
                        break;
                    case (22):
                        newEnemy = new SmellyLettuce(true);
                        break;
                    case (23):
                        newEnemy = new LimeyLemon(true);
                        break;
                    case (24):
                        WavePaused = true;
                        EnemiesLeft = 0;
                        newEnemy = new AlexanderHamilton();
                        break;
                    default:
                        newEnemy = null;
                        break;
                }

                if (newEnemy == null)
                    return;

                int spawnPointIndex = rand.Next(0, GameScene.CurrentMap.SpawnPoints.Count);
                Point spawnAt = (GameScene.CurrentMap.SpawnPoints[spawnPointIndex]);

                Vector2 spawnVector = new Vector2(spawnAt.X * TileEngine.TileWidth, spawnAt.Y * TileEngine.TileHeight);

                newEnemy.Initialize(spawnVector);

                WaveText = "Current Wave:\n " + newEnemy.Name;
            }
        }