示例#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;
        }
示例#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;
        }
示例#3
0
 private void CreateActionScene()
 {
     explosions              = new ExplosionManager(this);
     actionElementsTexture   = Content.Load <Texture2D>("rockrainenhanced.png");
     actionBackgroundTexture = Content.Load <Texture2D>("spacebackground.jpg");
     scoreFont   = Content.Load <SpriteFont>("score");
     actionScene = new ActionScene(this, actionElementsTexture, actionBackgroundTexture, scoreFont, explosions);
     Components.Add(actionScene);
 }
示例#4
0
文件: Game1.cs 项目: QHebert/monogame
 private void CreateActionScene()
 {
     explosions = new ExplosionManager(this);
     actionElementsTexture = Content.Load<Texture2D>("rockrainenhanced.png");
     actionBackgroundTexture = Content.Load<Texture2D>("spacebackground.jpg");
     scoreFont = Content.Load<SpriteFont>("score");
     actionScene = new ActionScene(this, actionElementsTexture,actionBackgroundTexture, scoreFont, explosions);
     Components.Add(actionScene);
 }