示例#1
0
        public static Enemy[] GetRandomEnemy(int amount, int powerLevel)
        {
            Enemy        enemy   = null;
            List <Enemy> enemies = new List <Enemy>();
            int          rand    = gen.Next(0, 4);

            switch (rand)
            {
            case (0):
                for (int i = 0; i < amount; i++)
                {
                    enemy = new MeleeEnemy();
                    enemy.BuildEnemy(powerLevel);
                    enemies.Add(enemy);
                }
                break;

            case (1):
                for (int i = 0; i < amount; i++)
                {
                    enemy = new RangedEnemy();
                    enemy.BuildEnemy(powerLevel);
                    enemies.Add(enemy);
                }
                break;

            case (2):
                for (int i = 0; i < amount; i++)
                {
                    enemy = new MageEnemy();
                    enemy.BuildEnemy(powerLevel);
                    enemies.Add(enemy);
                }
                break;

            case (3):
                for (int i = 0; i < amount; i++)
                {
                    enemy = new GuardianEnemy();
                    enemy.BuildEnemy(powerLevel);
                    enemies.Add(enemy);
                }
                break;
            }

            return(enemies.ToArray());
        }
示例#2
0
        public static Enemy[] GetRandomEnemy(int amount, int powerLevel)
        {
            Enemy enemy = null;
            List<Enemy> enemies = new List<Enemy>();
            int rand = gen.Next(0, 4);
            switch(rand)
            {
                case(0):
                    for (int i = 0; i < amount; i++)
                    {
                        enemy = new MeleeEnemy();
                        enemy.BuildEnemy(powerLevel);
                        enemies.Add(enemy);
                    }
                    break;
                case (1):
                    for (int i = 0; i < amount; i++)
                    {
                        enemy = new RangedEnemy();
                        enemy.BuildEnemy(powerLevel);
                        enemies.Add(enemy);
                    }
                    break;
                case (2):
                    for (int i = 0; i < amount; i++)
                    {
                        enemy = new MageEnemy();
                        enemy.BuildEnemy(powerLevel);
                        enemies.Add(enemy);
                    }
                    break;
                case (3):
                    for (int i = 0; i < amount; i++)
                    {
                        enemy = new GuardianEnemy();
                        enemy.BuildEnemy(powerLevel);
                        enemies.Add(enemy);
                    }
                    break;
            }

            return enemies.ToArray();
        }