Beispiel #1
0
 protected Level( ContentManager contentManager, LevelManager.Levels level )
 {
     m_contentManager = contentManager;
     m_levelEnum = level;
     m_levelRectangle = Rectangle.Empty;
     m_levelMap = new TileMap();
 }
        public void LoadContent(ContentManager content)
        {
            //init player
            m_player = new PlayerSprite(content.Load<Texture2D>("MonoGameContent/Sprites/MarioSprite"), new Vector2(0.0f, 0.0f));

            //init camera
            m_playerCamera = new PlayerCamera(Main.Instance.GraphicsDevice.Viewport, 1.0f);

            m_levelManager = new LevelManager(LevelManager.Levels.JungTown, new JungTown());

            //after everything has been loaded in, we initialize our partition trees, and send them to the current level to be populated
            m_drawTree = new QuadPartitionTree<IPartitionNode>(m_levelManager.LevelRectangle);
            m_collisionTree = new QuadPartitionTree<IPartitionNode>(m_levelManager.LevelRectangle);

            //load elements into partition trees
            PopulateTrees();

            //Set the graphics rectangle
            m_graphicsRectangle = new Rectangle((int)m_player.Center.X - VIEWPORTWIDTH, (int)m_player.Center.Y - VIEWPORTHEIGHT, VIEWPORTWIDTH * 2, VIEWPORTHEIGHT * 2);
        }