Пример #1
0
        public override void initialize(string data)
        {
            this.alpha = 0;
            this.returnData = "";
            this.timer = 0.0;
            this.cleansed = new Sprite(spriteBatch, game, Constants.GUI_LEVEL_CLEANSED);
            cleansedOffset = cleansed.Dimension * 0.5f;
            levelManager = new LevelManager();
            entityManager = new EntityManager(spriteBatch, game, audio, levelManager);

            player = new Player(spriteBatch, game, audio, "player", entityManager, controls);
            Vector2 newPlayerPos = new Vector2((float)Constants.RESOLUTION_VIRTUAL_WIDTH - 200f, (float)Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f);
            player.Position = newPlayerPos;
            entityManager.addEntity(player);
            entityManager.initialize();

            Level level = new Level(spriteBatch, game, audio, entityManager, player, controls, Constants.LEVEL01, "level01");
            levelManager.AddLevel(level);
            level = new Level(spriteBatch, game, audio, entityManager, player, controls, Constants.LEVEL02, "level02");
            levelManager.AddLevel(level);
            level = new Level(spriteBatch, game, audio, entityManager, player, controls, Constants.LEVEL03, "level03");
            levelManager.AddLevel(level);

            levelManager.setLevel(data);
            levelComplete = false;
            secondFade = new FadeInOut(spriteBatch, game);
            secondFade.Reset();
            secondFade.alphaValue = 1;
            fade = new FadeInOut(spriteBatch, game);
            fade.Reset();
            fade.FadeIn();
            audio.playMusic("main_music");
        }
Пример #2
0
 public Level(SpriteBatch spriteBatch, Soul game, AudioManager audioManager, EntityManager entityManager, Player player, InputManager controls, string filename, string id)
 {
     this.spriteBatch = spriteBatch;
     this.game = game;
     this.entityManager = entityManager;
     this.id = id;
     this.controls = controls;
     levelReader = new LevelReader(filename, game);
     this.player = player;
     font = game.Content.Load<SpriteFont>("GUI\\Extrafine");
     this.audioManager = audioManager;
 }