Exemplo n.º 1
0
        public DialogSystem(Game game)
            : base(game)
        {
            this._parser = new XML_Parser(game);
            this._dialogstarted = false;
            this._font = game.Content.Load<SpriteFont>("Test");
            this._dialogbox = game.Content.Load<Texture2D>("dialogbox");

            (Game as Game1)._input.Interact.Pressed += new EventHandler(TestDialog);
        }
Exemplo n.º 2
0
        /// <summary>
        /// LoadContent wird einmal pro Spiel aufgerufen und ist der Platz, wo
        /// Ihr gesamter Content geladen wird.
        /// </summary>
        protected override void LoadContent()
        {
            // Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _tileSetTexture = Content.Load<Texture2D>(@"grass");
            _treeTexture = Content.Load<Texture2D>("tree");
            _deadTreeTexture = Content.Load<Texture2D>("deadtree");
            _gruselUteTexture = Content.Load<Texture2D>("wildboar");
            _blackHoleTexture = Content.Load<Texture2D>("blackhole");
            _potionTexture = Content.Load<Texture2D>("potion");
            _cestTexture = Content.Load<Texture2D>("Schatztruhe");

            _input = new InputManager(this);
            _interface = new Interface(this);

            _player = new Player(this);
            _parser = new XML_Parser(this);
            _dialogSystem = new DialogSystem(this);
            //_parser.SetFilename("Horst");
            //_parser.SaveText();
            _parser.SetFilename("0");

            //_parser.SetLevel();
            //_parser.SaveLevel();
            try
            {
                _parser.LoadLevel();
                _currentLevel = _parser.GetLevel();
            }
            catch (Exception e)
            {
                _currentLevel = new Level(this);
                int[,] layer0 = new int[,] {
                            {1,1,1,1,1,1,1,1},
                            {1,9,9,9,9,9,9,1},
                            {1,9,9,9,9,9,9,1},
                            {1,9,9,54,111,111,9,1},
                            {1,9,9,9,111,111,9,1},
                            {1,9,9,9,9,54,9,1},
                            {1,9,9,9,9,9,9,1},
                            {1,1,1,1,1,1,1,1}};
                int[,] layer1 = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 87 } };
                layer0[1, 5] = 65;
                _currentLevel.AddFloor(layer0);
                _currentLevel.AddCeiling(new int[0, 0]);
            }
            PlayerClasses.CollisionDetector.Setup(_currentLevel);

            this.Components.Add(_input);

            _currentLevel.LoadContent();

            _player.LoadContent(Content);

            // TODO: Verwenden Sie this.Content, um Ihren Spiel-Inhalt hier zu laden
        }