Exemplo n.º 1
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="game">The main game object</param>
        /// <param name="theTexture">Texture with the sprite elements</param>
        /// <param name="backgroundTexture">Texture for the background</param>
        /// <param name="font">Font used in the score</param>
        public ActionScene(Game game, Texture2D theTexture,
                           Texture2D backgroundTexture, SpriteFont font, ExplosionManager explosions)
            : base(game)
        {
            // Get the current audiocomponent and play the background music
            audio = (AudioLibrary)Game.Services.GetService(typeof(AudioLibrary));

            background = new ImageComponent(game, backgroundTexture,
                                            ImageComponent.DrawMode.Stretch);
            Components.Add(background);

            actionTexture = theTexture;

            spriteBatch = (SpriteBatch)
                          Game.Services.GetService(typeof(SpriteBatch));
            meteors = new MeteorsManager(Game, ref actionTexture);
            Components.Add(meteors);

            player = new Player(Game, ref actionTexture);
            player.Initialize();
            Components.Add(player);

            score          = new Score(game, font, Color.LightGray);
            score.Position = new Vector2(1, 1);
            Components.Add(score);

            powerSource = new PowerSource(game, ref actionTexture);
            powerSource.Initialize();
            Components.Add(powerSource);

            _explosions = explosions;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="game">The main game object</param>
        /// <param name="theTexture">Texture with the sprite elements</param>
        /// <param name="backgroundTexture">Texture for the background</param>
        /// <param name="font">Font used in the score</param>
        public ActionScene(Game game, Texture2D theTexture, 
            Texture2D backgroundTexture, SpriteFont font, ExplosionManager explosions) 
            : base(game)
        {
            // Get the current audiocomponent and play the background music
            audio = (AudioLibrary)Game.Services.GetService(typeof(AudioLibrary));

            background = new ImageComponent(game, backgroundTexture, 
                ImageComponent.DrawMode.Stretch);
            Components.Add(background);

            actionTexture = theTexture;

            spriteBatch = (SpriteBatch) 
                Game.Services.GetService(typeof (SpriteBatch));
            meteors = new MeteorsManager(Game, ref actionTexture);
            Components.Add(meteors);

            player = new Player(Game, ref actionTexture);
            player.Initialize();
            Components.Add(player);

            score = new Score(game, font, Color.LightGray);
            score.Position = new Vector2(1, 1);
            Components.Add(score);

            powerSource = new PowerSource(game, ref actionTexture);
            powerSource.Initialize();
            Components.Add(powerSource);
			
			_explosions = explosions;
        }