示例#1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            //--Cargar los assets
            _sfxBotonPresionado = Content.Load <SoundEffect>(SONIDO_BOTON);
            _sfxImpacto         = Content.Load <SoundEffect>(SONIDO_IMPACTO);
            _sfxRecordAlcanzado = Content.Load <SoundEffect>(SONIDO_RECORDALCANZADO);

            _hojaDeImagenes = Content.Load <Texture2D>(SPRITE_SHEET);

            _texturaDelFadeIn = new Texture2D(GraphicsDevice, 1, 1);
            _texturaDelFadeIn.SetData(new Color[] { Color.White });

            _trex = new Trex(_hojaDeImagenes, new Vector2(TREX_POS_INICIAL_X, TREX_POS_INICIAL_Y - Trex.TREX_SPRITE_POS_ALTO), _sfxBotonPresionado);
            _trex.OrdenDeDibujo  = 10;
            _trex.SaltoCompleto += trex_SaltoCompleto;

            _puntajes = new MostrarPuntaje(_hojaDeImagenes, new Vector2(PUNTAJE_POS_X, PUNTAJE_POS_Y), _trex);
            //_puntajes.Puntaje = 498;
            //_puntajes.PuntajeRecord = 12345;

            _entrada    = new ControladorDeEntrada(_trex);
            _terreno    = new ManagerDeTerreno(_hojaDeImagenes, _manager, _trex);
            _obstaculos = new ManagerDeObstaculos(_hojaDeImagenes, _manager, _trex, _puntajes);

            _manager.Agregar(_trex);
            _manager.Agregar(_terreno);
            _manager.Agregar(_puntajes);
            _manager.Agregar(_obstaculos);
            _terreno.Inicializar();
        }
示例#2
0
 public ManagerDeObstaculos(Texture2D textura, ManagerDeEntidades managerDeEntidades, Trex trex, MostrarPuntaje mostrarPuntaje)
 {
     _textura            = textura;
     _managerDeEntidades = managerDeEntidades;
     _trex     = trex;
     _puntajes = mostrarPuntaje;
     _random   = new Random();
 }