private void generateEnemiesOnTheMap(string which_enemies)
        {
            //enemy_arrival_dict[key] = true;
            names_to_load = new List <string>()
            {
                "enemy_blue", "enemy_green", "enemy_red"
            };
            Dictionary <string, GameObject> enemy_test = EnemyGenerator.generateEnemies(gameObjectsGenerator.getListOfGameObjects(names_to_load), 4);

            foreach (var item in enemy_test.Keys)
            {
                enemy_arrival_dict[which_enemies].Add(item);
                current_enemies.Add(item);
            }

            screenManager.getScreen(GameStatesEnum.GAME).addNewObjectsToTheScreen(enemy_test);
        }
Esempio n. 2
0
        public static Dictionary <string, GameObject> generateEnemies(List <GameObject> enemyTypes, int enemies_to_generate)
        {
            List <string> names = EnemyGenerator.generateEnemyNames(enemies_to_generate);
            Dictionary <string, GameObject> enemy_dict = new Dictionary <string, GameObject>();
            Random random_generator = new Random(DateTimeOffset.Now.Millisecond);
            int    enemy_width      = enemyTypes[0].ObjectShape.Width;
            int    current_x_position_of_generated_enemy = 0;

            for (int i = 0; i < enemies_to_generate; i++)
            {
                GameObject new_enemy =
                    new GameObject(enemyTypes[random_generator.Next(0, enemyTypes.Count)]);
                new_enemy.moveObject(new Point(current_x_position_of_generated_enemy, 0));
                current_x_position_of_generated_enemy += enemy_width;
                enemy_dict.Add(names[i], new_enemy);
            }


            return(enemy_dict);
        }