Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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, () =>
            {
            });
        }
Esempio n. 3
0
        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));
                    }
                }
            });
        }