Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            devFont = Content.Load<SpriteFont>("Fonts/devFont");

            // TODO: use this.Content to load your game content here

            myTexture = Content.Load<Texture2D>("Graphics/player_ship");
            enemyTexture = Content.Load<Texture2D>("Graphics/enemy_ship");
            projectileTexture = Content.Load<Texture2D>("Graphics/projectiles");
            cloudsTexture = Content.Load<Texture2D>("Graphics/clouds1");
            explosionsTexture = Content.Load<Texture2D>("Graphics/explosions");
            zeppelinTexture = Content.Load<Texture2D>("Graphics/zeppelin");
            blackPixelTexture = Content.Load<Texture2D>("Graphics/BlackPixel");
            mainMenuTexture = Content.Load<Texture2D>("Graphics/startScreen");
            deathScreenTexture = Content.Load<Texture2D>("Graphics/endScreen");      // FIXME
            healthTickTexture = Content.Load<Texture2D>("Graphics/healthTick");
            powerUpsTexture = Content.Load<Texture2D>("Graphics/powerups");

            explosion1 = Content.Load<SoundEffect>("Sfx/explosion1");
            gunShot1 = Content.Load<SoundEffect>("Sfx/magnum1");
            engineLoop = Content.Load<SoundEffect>("Sfx/engine_loop");

            // song to loop:
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(Content.Load<Song>("Music/taiko_piece"));
            MediaPlayer.Volume = 1.0f;

            listOfEntities = new List<Entity>();

            listOfExplosions = new List<Entity>();

            listOfPowerUps = new List<Entity>();

            newEntities = new List<Entity>();

            // this isn't necessary right now, but having a List later, esp. when file-names
            // are drawn from external data, will be very useful. probably want to have a separate
            // class to deal with texture data & names
            listOfTextures = new List<Texture2D> {
                myTexture,
                enemyTexture,
                projectileTexture,
                cloudsTexture,
                explosionsTexture,
                zeppelinTexture,
                blackPixelTexture,
                healthTickTexture,
                powerUpsTexture
            };

            // create the full-screen fader for fading in and out (how cinematic!)
            fader = new Fader(blackPixelTexture, fullScreen);
            fader.fadeIn(Fader.DEFAULT_FADE_SHIFT);

            // create our player's ship and assign it:
            player = new PlayerShip(myTexture);

            listOfEntities.Add(player);         // add the player entity to our global list of entities

            hudHealthBar = new HealthBar(healthTickTexture, player.GetHealth(), player.GetMaxHealth());

            PowerUp tmpPowerUp = new PowerUp(powerUpsTexture, PowerUpType.repair, new Vector2(400, 100));

            listOfPowerUps.Add(tmpPowerUp);

            /*            // test enemy -- this should really go elsewhere:
            EnemyShip tmpEnemy = new EnemyShip(enemyTexture, ShipType.Grey, AIType.Basic, new Vector2(300, 0), this);

            listOfEntities.Add(tmpEnemy);       // make sure to add all entities to our global list!
            ++numberOfEnemies;

            zeppBoss = new ZeppelinBoss(zeppelinTexture, new Vector2(0, -100), this);

            listOfEntities.Add(zeppBoss); */
        }