Пример #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);

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

            //audioEngine = new AudioEngine("Content\\Audio\\3dAlienGameAudio.xgs");
            //waveBank = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb");
            //soundBank = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb");

            CameraObject.CreateDefaultCamera(graphics);

            terrain = new GameObject(
                Content.Load <Model>("Models\\terrain")
                );

            launcherBase = new GameObject(
                Content.Load <Model>("Models\\launcher_base"),
                0.2f
                );

            launcherHead = new GameObject(
                Content.Load <Model>("Models\\launcher_head"),
                0.2f,
                launcherBase.Position + new Vector3(0.0f, 20.0f, 0.0f)
                );

            missiles = new LivingGameObject[MISSILE_COUNT];
            for (int i = 0; i < missiles.Length; i++)
            {
                missiles[i] = new LivingGameObject(
                    Content.Load <Model>(
                        "Models\\missile"),
                    3.0f
                    );
            }

            enemies = new LivingGameObject[ENEMY_SHIP_COUNT];
            for (int i = 0; i < enemies.Length; i++)
            {
                enemies[i] = new LivingGameObject(
                    Content.Load <Model>(
                        "Models\\enemy"),
                    0.1f,
                    Vector3.Zero,
                    new Vector3(
                        0.0f,
                        MathHelper.Pi,
                        0.0f
                        )
                    );
            }
        }
Пример #2
0
 private void TestCollision(LivingGameObject missile)
 {
     foreach (LivingGameObject enemy in enemies)
     {
         if (enemy.IsAlive && enemy.Bounds.Intersects(missile.Bounds))
         {
             // soundBank.PlayCue("explosion");
             enemy.IsAlive   = false;
             missile.IsAlive = false;
         }
     }
 }