示例#1
0
        public Level(Game game, string name, TileMap map, List<Enemy> enemies, Player player)
            : base(game)
        {
            levelComponents = new List<GameComponent>();
            Name = name;
            this.map = map;
            this.enemies = enemies;
            this.player = player;

            levelComponents.Add(map);
            levelComponents.Add(player);
            foreach (var enemy in enemies)
                levelComponents.Add(enemy);
        }
示例#2
0
        public GameScene(Game game)
            : base(game)
        {
            // Initialize map settings
            camera = new Camera(game, new Rectangle(0, 0, 800, 480)); // TODO: Fix this so it is not hardcoded -> GraphicsDevice is not initialized at this point, need to wrap it somehow (perhaps add it as a service) so the camera will access it later when it's initialized

            MapInformation mapInformation = new MapInformation(Game);
            mapInformation.LoadMapFromXML("test map");
            map = MapGenerator.Generate(mapInformation, camera);

            Font gameTitle = new Font(game, "Generated map", new Vector2(0, 0), Color.Black);

            crossControl = new CrossControl(game);

            // Player
            player = new Player(game, camera);
            SceneComponents.Add(map);
            SceneComponents.Add(gameTitle);
            SceneComponents.Add(player);
            SceneComponents.Add(crossControl);
        }