Пример #1
0
        public void ResetLevel()
        {
            levelHolder.Clear();
            cameraHolder.Clear();
            viewHolder.Clear();

            level = new Level();
            level.LoadLevelContent("Underworld.xml", this);
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);
            level = new Level();
            level.LoadLevelContent("UnderworldTwo.xml", this);
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);
            level = new Level();
            level.LoadLevelContent("UnderworldThree.xml", this);
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);

            level = new Level();
            level.LoadLevelContent("Overworld.xml", this);
            level.SetStaticPlayer();
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);

            controller.ClearKeyBindings();
            controller.InitWASD(this, level);
            GlobalVariables.ResetVar();

            MusicPlayer.PlaySong("LoopTheme");
        }
Пример #2
0
        protected override void Initialize()
        {
            mainFont = Content.Load <SpriteFont>("MainFont");

            spriteBatch = new SpriteBatch(GraphicsDevice);
            SpriteFactory.Instance.SpriteBatch = spriteBatch;
            SpriteMachine.LoadTextures(Content);

            levelHolder  = new Queue();
            viewHolder   = new Queue();
            cameraHolder = new Queue();

            level = new Level();
            level.LoadLevelContent("Underworld.xml", this);
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);
            level = new Level();
            level.LoadLevelContent("UnderworldTwo.xml", this);
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);
            level = new Level();
            level.LoadLevelContent("UnderworldThree.xml", this);
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);

            controller = new KeyboardController();
            GlobalVariables.InitializeVar();

            level = new Level();
            level.LoadLevelContent("Overworld.xml", this);
            level.SetStaticPlayer();
            levelHolder.Enqueue(level);
            camera = new Camera(spriteBatch, mainFont);
            cameraHolder.Enqueue(camera);
            view = new CameraManager((Mario)level.Player, camera);
            viewHolder.Enqueue(view);
            controller.InitWASD(this, level);
            base.Initialize();
        }