Exemplo n.º 1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            if (!initialized)
            {
                this.keyboard = new GameKeyboard();
                bossSong = game.Content.Load<Song>("Music/vengeance");
                gameSong = game.Content.Load<Song>("Music/menumusic");
                menuSong = game.Content.Load<Song>("Music/shadowforce");
                this.components = new List<GameComponent>();
                this.player = new PlayerShip(game, this);
                this.arsenal = new Arsenal(game, this);
                this.components.Add(this.Player);
                this.components.Add(this.arsenal);
                this.newComponents = new List<GameComponent>();
                this.oldComponents = new List<GameComponent>();
                this.lose = -1;

                this.random = new Random();
                this.content = game.Content;

                this.gameSpeed = 10;
                this.ResetSpeedTimer();
                this.ResetBossTimer();
                this.intro = 300;

                shipAnimationStatic = new Animation(this.Game.Content, "Sprites/playerShip", 32, 16, 1, 1);

                foreach (GameComponent component in this.components)
                {
                    component.Initialize();
                }

                initialized = true;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     Content.RootDirectory = "GameJamTestContent";
     MediaPlayer.Volume=0.5f;
     //MediaPlayer.Volume = 0;
     base.Initialize();
     GameServices.AddService<GraphicsDevice>(GraphicsDevice);
     GameServices.AddService<ContentManager>(Content);
     keyboard = new GameKeyboard();
 }