예제 #1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            player.Update(gameTime);

            switch (nivel)
            {
            case 1:
                if (!nivelHuitzi.nivelCompleto)
                {
                    foreach (CollisionTiles tile in nivelHuitzi.getMapa().CollisionTiles)
                    {
                        player.Collision(tile.Rectangle, nivelHuitzi.getMapa().Width, nivelHuitzi.getMapa().Height);
                        camera.Update(player.posicion, nivelHuitzi.getMapa().Width, nivelHuitzi.getMapa().Height);
                    }
                    nivelHuitzi.Update(gameTime, player);
                }
                else if (!player.muerteBool)
                {
                    nivel = 2;
                    camera.setNivel(nivel);
                    nivelHuitzi = null;

                    nivelMclan    = new NivelMictlan(Content, GraphicsDevice);
                    nivelGenerico = (Nivel)nivelMclan;
                    nivelMclan.Load(Content, dev);
                    nivelMclan.setCamera(camera);
                }
                break;

            case 2:
                if (!nivelMclan.nivelCompleto)
                {
                    foreach (CollisionTiles tile in nivelMclan.getMapa().CollisionTiles)
                    {
                        player.Collision(tile.Rectangle, nivelMclan.getMapa().Width, nivelMclan.getMapa().Height);
                        camera.Update(player.posicion, nivelMclan.getMapa().Width, nivelMclan.getMapa().Height);
                    }
                    nivelMclan.Update(gameTime, player);
                }
                else if (!player.muerteBool)
                {
                    nivel      = 3;
                    nivelMclan = null;
                }
                break;

            case 3:

                break;
            }

            HUD.Update();
            base.Update(gameTime);
        }
예제 #2
0
 protected override void LoadContent()
 {
     muestra     = Content.Load <SpriteFont>("MuestraDatos");
     spriteBatch = new SpriteBatch(GraphicsDevice);
     camera      = new Camara(GraphicsDevice.Viewport);
     player.Load(Content);
     dev = graphics.GraphicsDevice;
     HUD.Load(Content, dev);
     nivelHuitzi = new NivelHuitzi(Content, dev);
     nivelHuitzi.Load(Content, dev);
     nivelGenerico = (Nivel)nivelHuitzi;
     camera.setNivel(nivel);
 }