public void Load() { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(levelDir, FileMode.Open, FileAccess.Read, FileShare.Read); level = (Level)formatter.Deserialize(stream); stream.Close(); level.Initialize(blockWidth, graphicsDevice, null); }
public GameScreen(GraphicsDevice graphicsDevice, Game1 game1, Level level) : base(graphicsDevice, game1) { this.level = level; key = Keyboard.GetState(); mouse = Mouse.GetState(); blockWidth = graphicsDevice.Viewport.Height / 15; background = LoadedContent.bg1; flaggy = true; level.Initialize(blockWidth, graphicsDevice, () => { }); }
public void Load() { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(levelDir, FileMode.Open, FileAccess.Read, FileShare.Read); level = (Level)formatter.Deserialize(stream); stream.Close(); level.Initialize(blockWidth, graphicsDevice, () => { string newDir = LevelManager.nextLevel(levelDir); if (goToNextLevel) { if (newDir != null) { game1.SetScreen(new GameScreen(graphicsDevice, game1, LevelManager.nextLevel(levelDir), true)); } else { game1.SetScreen(new Start_Menu(graphicsDevice, game1)); } } }); }