protected override void LoadContent()
        {
            m_song = Content.Load<Song>("FightForFreedoms");

            DebugHelp.Draw_BoundingBox.Init(Content.Load<Effect>("lines"), GraphicsDevice);

            m_vis.Init(GraphicsDevice);

            Enemy_Container.Init(m_world, Content);

            Graphics.Entity.Text debug_text = new Graphics.Entity.Text();
            debug_text.Init(Content.Load<SpriteFont>("default_font"));

            Graphics.Entity.Sprite hud = new Graphics.Entity.Sprite();
            hud.Init(Content.Load<Texture2D>("scope-hd"), GraphicsDevice.Viewport.Bounds);
            hud.Visible = false;
            m_player = new Player(hud, debug_text, Content.Load<SoundEffect>("Fire"));
            m_world.AddEntity(m_player);
            m_player.LoadIcons(GraphicsDevice, "Bullet-Icon", "Enemy-Icon", Content, m_vis);

            List<Entity_Explosion> explosions_list = new List<Entity_Explosion>();

            for (int i = 0; i < 4; i++)
            {
                Graphics.Entity.Billboard explosion_model = new Graphics.Entity.Billboard();
                explosion_model.Init(Content.Load<Model>("Explosion"),
                                    Content.Load<Effect>("EffectBillboard"),
                                    Content.Load<Texture2D>("explosion_texture"));
                Entity_Explosion explosion = new Entity_Explosion(explosion_model);
                m_world.AddEntity(explosion);
                explosions_list.Add(explosion);
            }

            List<SoundEffect> explosion_sound = new List<SoundEffect>();

            for (int i = 0; i < 3; i++)
            {
                SoundEffect new_explosion_sound = Content.Load<SoundEffect>("explode_" + (i+1));
                explosion_sound.Add(new_explosion_sound);
            }

            BasicEffect city_effect = new BasicEffect(GraphicsDevice);
            city_effect.FogEnabled = true;
            city_effect.FogColor = new Vector3(0.6f, 0.6f, 0.6f);
            city_effect.FogStart = 0.0f;
            city_effect.FogEnd = 2000.0f;
            city_effect.SpecularPower = 10000000.0f;

            Graphics.Entity.Model city = new Graphics.Entity.Model();
            city.Init(Content.Load<Model>("city/city"));
            city.basiceffect = city_effect;
            m_city = new Entity_City(city, explosions_list, explosion_sound);
            m_world.AddEntity(m_city);

            Graphics.Entity.SkyBox skybox = new Graphics.Entity.SkyBox();
            skybox.Init(Content.Load<Model>("skybox/skysphere"),
                        Content.Load<Effect>("skybox/skybox_fx"),
                        Content.Load<TextureCube>("skybox/skytexture"));
            m_skybox = new Entity_SkyBox(skybox);
            m_world.AddEntity(m_skybox);

            //Menu

            m_menu.Init(Content, m_vis, m_world, GraphicsDevice);

            //Fonts

            m_ingame_text = new Graphics.Entity.Text();
            m_ingame_text.Init(Content.Load<SpriteFont>("InGameFont"));
            m_ingame_text.text = "Shoot All The Terrorists Before They Set The Bombs Off...";
            m_ingame_text.Visible = false;
            m_ingame_text.position = new Vector2((GraphicsDevice.Viewport.Width * 0.5f) -
                m_ingame_text.font.MeasureString(m_ingame_text.text).X * 0.5f,
                0.0f);
            m_vis.AddEntity(m_ingame_text);

            m_clock_text = new Graphics.Entity.Text();
            m_clock_text.Init(Content.Load<SpriteFont>("InGameFont"), "00:00:60");
            m_clock_text.Visible = false;
            m_clock_text.position = new Vector2(
                (((float)GraphicsDevice.Viewport.Width / 1366.0f) * 1024.0f),
                (((float)GraphicsDevice.Viewport.Height / 768.0f) * 690.0f) );
            m_vis.AddEntity(m_clock_text);

            m_clock_tick = Content.Load<SoundEffect>("clockTick");

            m_black_screen = new Graphics.Entity.Sprite();
            m_black_screen.Init(Content.Load<Texture2D>("blackPixel"),
                new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height) );
            m_black_screen.Visible = false;
            m_vis.AddEntity(m_black_screen);

            //play audio
            MediaPlayer.Volume = 0.5f;
            MediaPlayer.Play(m_song);
            MediaPlayer.IsRepeating = true;

            #if DEBUG
            m_vis.AddEntity(debug_text);
            #endif
        }
Пример #2
0
        protected override void LoadContent()
        {
            m_song = Content.Load <Song>("FightForFreedoms");

            DebugHelp.Draw_BoundingBox.Init(Content.Load <Effect>("lines"), GraphicsDevice);

            m_vis.Init(GraphicsDevice);

            Enemy_Container.Init(m_world, Content);

            Graphics.Entity.Text debug_text = new Graphics.Entity.Text();
            debug_text.Init(Content.Load <SpriteFont>("default_font"));

            Graphics.Entity.Sprite hud = new Graphics.Entity.Sprite();
            hud.Init(Content.Load <Texture2D>("scope-hd"), GraphicsDevice.Viewport.Bounds);
            hud.Visible = false;
            m_player    = new Player(hud, debug_text, Content.Load <SoundEffect>("Fire"));
            m_world.AddEntity(m_player);
            m_player.LoadIcons(GraphicsDevice, "Bullet-Icon", "Enemy-Icon", Content, m_vis);

            List <Entity_Explosion> explosions_list = new List <Entity_Explosion>();

            for (int i = 0; i < 4; i++)
            {
                Graphics.Entity.Billboard explosion_model = new Graphics.Entity.Billboard();
                explosion_model.Init(Content.Load <Model>("Explosion"),
                                     Content.Load <Effect>("EffectBillboard"),
                                     Content.Load <Texture2D>("explosion_texture"));
                Entity_Explosion explosion = new Entity_Explosion(explosion_model);
                m_world.AddEntity(explosion);
                explosions_list.Add(explosion);
            }

            List <SoundEffect> explosion_sound = new List <SoundEffect>();

            for (int i = 0; i < 3; i++)
            {
                SoundEffect new_explosion_sound = Content.Load <SoundEffect>("explode_" + (i + 1));
                explosion_sound.Add(new_explosion_sound);
            }

            BasicEffect city_effect = new BasicEffect(GraphicsDevice);

            city_effect.FogEnabled    = true;
            city_effect.FogColor      = new Vector3(0.6f, 0.6f, 0.6f);
            city_effect.FogStart      = 0.0f;
            city_effect.FogEnd        = 2000.0f;
            city_effect.SpecularPower = 10000000.0f;

            Graphics.Entity.Model city = new Graphics.Entity.Model();
            city.Init(Content.Load <Model>("city/city"));
            city.basiceffect = city_effect;
            m_city           = new Entity_City(city, explosions_list, explosion_sound);
            m_world.AddEntity(m_city);

            Graphics.Entity.SkyBox skybox = new Graphics.Entity.SkyBox();
            skybox.Init(Content.Load <Model>("skybox/skysphere"),
                        Content.Load <Effect>("skybox/skybox_fx"),
                        Content.Load <TextureCube>("skybox/skytexture"));
            m_skybox = new Entity_SkyBox(skybox);
            m_world.AddEntity(m_skybox);

            //Menu

            m_menu.Init(Content, m_vis, m_world, GraphicsDevice);

            //Fonts

            m_ingame_text = new Graphics.Entity.Text();
            m_ingame_text.Init(Content.Load <SpriteFont>("InGameFont"));
            m_ingame_text.text     = "Shoot All The Terrorists Before They Set The Bombs Off...";
            m_ingame_text.Visible  = false;
            m_ingame_text.position = new Vector2((GraphicsDevice.Viewport.Width * 0.5f) -
                                                 m_ingame_text.font.MeasureString(m_ingame_text.text).X * 0.5f,
                                                 0.0f);
            m_vis.AddEntity(m_ingame_text);

            m_clock_text = new Graphics.Entity.Text();
            m_clock_text.Init(Content.Load <SpriteFont>("InGameFont"), "00:00:60");
            m_clock_text.Visible  = false;
            m_clock_text.position = new Vector2(
                (((float)GraphicsDevice.Viewport.Width / 1366.0f) * 1024.0f),
                (((float)GraphicsDevice.Viewport.Height / 768.0f) * 690.0f));
            m_vis.AddEntity(m_clock_text);

            m_clock_tick = Content.Load <SoundEffect>("clockTick");

            m_black_screen = new Graphics.Entity.Sprite();
            m_black_screen.Init(Content.Load <Texture2D>("blackPixel"),
                                new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height));
            m_black_screen.Visible = false;
            m_vis.AddEntity(m_black_screen);

            //play audio
            MediaPlayer.Volume = 0.5f;
            MediaPlayer.Play(m_song);
            MediaPlayer.IsRepeating = true;

#if DEBUG
            m_vis.AddEntity(debug_text);
#endif
        }