Пример #1
0
 public Entity_SkyBox(Graphics.Entity.Model model)
 {
     m_model    = model;
     m_position = new Vector3(0.0f, 0.0f, 0.0f);
     m_scale    = new Vector3(10.0f, 10.0f, 10.0f);
     m_rotation = Vector3.Zero;
 }
 public Entity_Explosion(Graphics.Entity.Model model)
 {
     m_model         = model;
     m_position      = new Vector3();
     m_scale         = new Vector3(4.0f, 4.0f, 4.0f);
     m_rotation      = new Vector3(0.0f, (float)Math.PI, 0.0f);
     m_model.Visible = false;
 }
Пример #3
0
 public Entity_Enemy(Graphics.Entity.Model model)
 {
     m_model            = model;
     m_position         = new Vector3(0.0f, 0.0f, 0.0f);
     m_scale            = new Vector3(0.05f, 0.05f, 0.05f);
     m_rotation         = Vector3.Zero;
     m_active_way_point = 1;
     m_rot_offset       = 0.0f;
 }
        public Entity_City(Graphics.Entity.Model model, List <Entity_Explosion> explosion, List <SoundEffect> explosion_sound)
        {
            m_model    = model;
            m_position = new Vector3(0.0f, -100.0f, 0.0f);
            m_scale    = Vector3.One;
            m_rotation = Vector3.Zero;

            m_explosion = explosion;

            m_explosion_sound = explosion_sound;

            m_explosion[0].position = Camera.position + new Vector3(0.0f, 0.0f, 300.0f);
            m_explosion[1].position = Camera.position + new Vector3(300.0f, 0.0f, 0.0f);
            m_explosion[2].position = Camera.position + new Vector3(0.0f, 0.0f, -300.0f);
            m_explosion[3].position = Camera.position + new Vector3(-300.0f, 0.0f, 0.0f);

            m_model.boundingbox_enabled = false;
        }
        public static void Init(World world, ContentManager content)
        {
            Random rand = new Random();

            for (int i = 0; i < GamePlay.enemy_count; i++)
            {
                Graphics.Entity.Model model = new Graphics.Entity.Model();
                model.Init(content.Load <Model>("enemy/enemy"));
                Entity_Enemy new_enemy = new Entity_Enemy(model);

                new_enemy.setSoundKill = content.Load <SoundEffect>("crit_death" + rand.Next(1, 5));
                new_enemy.position     = GamePlay.get_enemy(i).Position;
                new_enemy.rotation     = GamePlay.get_enemy(i).Rotation;
                new_enemy.waypoint     = GamePlay.get_enemy(i).WayPoint;
                m_enemy.Add(new_enemy);
                world.AddEntity(new_enemy);
            }
        }
        public static void Init(World world, ContentManager content)
        {
            Random rand = new Random();

            for (int i = 0; i < GamePlay.enemy_count; i++)
            {
                Graphics.Entity.Model model = new Graphics.Entity.Model();
                model.Init(content.Load<Model>("enemy/enemy"));
                Entity_Enemy new_enemy = new Entity_Enemy(model);

                new_enemy.setSoundKill = content.Load<SoundEffect>("crit_death" + rand.Next(1, 5));
                new_enemy.position = GamePlay.get_enemy(i).Position;
                new_enemy.rotation = GamePlay.get_enemy(i).Rotation;
                new_enemy.waypoint = GamePlay.get_enemy(i).WayPoint;
                m_enemy.Add(new_enemy);
                world.AddEntity(new_enemy);
            }
        }
        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
        }
Пример #8
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
        }