Exemplo n.º 1
0
        public weapon_reference(string weapon_name, GraphicsDevice p_device, ContentManager p_content, string p_folder,
                                string ani_idle, string ani_reload, string ani_shoot)
        {
            model = new CSMDModel(weapon_name, p_device, p_content, p_folder);
            String ani_folder = weapon_name + "_anims";

            model.cargar_ani(ani_folder, ani_idle);
            model.cargar_ani(ani_folder, ani_reload);
            model.cargar_ani(ani_folder, ani_shoot);
            model.anim[1].loop = false;
            model.setAnimation(0);
        }
Exemplo n.º 2
0
        void LoadContentGame()
        {
            font        = Content.Load <SpriteFont>("SpriteFonts/Arial");
            spriteBatch = new SpriteBatch(GraphicsDevice);

            EffectMesh = Content.Load <Effect>("Effects/BasicShader");
            EffectSmd  = Content.Load <Effect>("Effects/SMDEffect");
            EffectSmd.CurrentTechnique = EffectSmd.Techniques["SkinnedMesh"];

            // Arma
            weapon = new CWeapon(this, GraphicsDevice, Content, cs_folder);

            // Soldado
            soldier = new CSMDModel("player\\ct_sas", GraphicsDevice, Content, cs_folder);
            soldier.cargar_ani("player\\cs_player_shared_anims", "Death1");
            soldier.anim[0].loop = false;
            soldier.cargar_ani("player\\cs_player_shared_anims", "a_WalkN");
            soldier.anim[1].in_site = true;
            soldier_height          = soldier.size.Y;
            soldier.debugEffect     = EffectMesh;

            // Hostage
            for (int i = 0; i < NUM_HOSTAGE; ++i)
            {
                hostage_model[i] = new CSMDModel("characters\\hostage_0" + (i + 1).ToString(), GraphicsDevice, Content, cs_folder);
                hostage_model[i].cargar_ani("characters\\hostage_0" + (i + 1).ToString() + "_anims", "ragdoll");
                hostage_model[i].anim[0].loop = false;
                hostage_model[i].debugEffect  = EffectMesh;
            }


            // huevo de pascuas
            tgcLogo = Content.Load <Model>("Models/tgc-logo/tgc-logo");
            var modelEffect = (BasicEffect)tgcLogo.Meshes[0].Effects[0];

            modelEffect.DiffuseColor = Color.DarkBlue.ToVector3();
            modelEffect.EnableDefaultLighting();

            debug_box = new CDebugBox(GraphicsDevice);

            scene = new CBspFile(map_name, GraphicsDevice, Content);

            skybox = new CSkybox(GraphicsDevice);

            player = new CPlayer(scene, this);

            Random rnd = new Random();

            for (int i = 0; i < MAX_ENEMIGOS; ++i)
            {
                enemigo[i]          = new CEnemy(scene, this, soldier);
                enemigo[i].Position = new Vector3(rnd.Next((int)scene.p_min.X, (int)scene.p_max.X),
                                                  scene.p_max.Y, rnd.Next((int)scene.p_min.Z, (int)scene.p_max.Z));
                enemigo[i].Position = new Vector3(7242 + rnd.Next(-300, 300), -493, 6746 + rnd.Next(-300, 300));

                float an = rnd.Next(0, 360) * MathF.PI / 180.0f;
                enemigo[i].Direction        = new Vector3(MathF.Cos(an), 0, MathF.Sin(an));
                enemigo[i].currentTime      = rnd.Next(100);
                enemigo[i].currentAnimation = 1;
            }

            enemigo[0].PrevPosition = enemigo[0].Position = new Vector3(6447, -800, 6276);
            enemigo[0].Direction    = new Vector3(0, 0, -1);
            player.Position         = scene.info_player_start_pos;
            player.Direction        = new Vector3(0, 0, 1);

            cant_hostages = scene.cant_hostages;
            for (int i = 0; i < cant_hostages; ++i)
            {
                hostage[i]                  = new CEnemy(scene, this, hostage_model[i % 4]);
                hostage[i].Position         = scene.hostages[i].origin;
                hostage[i].Position.Y      += hostage_model[i % 4].cg.Y;
                hostage[i].currentAnimation = 0;
            }

            base.LoadContent();
        }