Example #1
0
 public void drawHitPoints(GraphicsDevice graphicsDevice, CDebugBox debug_box, Effect Effect, Matrix View, Matrix Proj)
 {
     for (int j = 0; j < cant_hp; ++j)
     {
         var     hpt = hit_points[j];
         Vector3 s   = new Vector3(1, 1, 1) * hpt.dw * 0.5f;
         var     p0  = hpt.Position;
         debug_box.Draw(graphicsDevice, p0 - s, p0 + s, Effect, Matrix.Identity, View, Proj);
     }
 }
Example #2
0
        public CSMDModel(string fname, GraphicsDevice p_device, ContentManager p_content, string p_folder)
        {
            name     = fname;
            folder   = p_folder + "smd\\";
            device   = p_device;
            Content  = p_content;
            matWorld = Matrix.Identity;

            if (debug_box == null)
            {
                debug_box = new CDebugBox(p_device);
            }

            cant_bones       = 0;
            bones            = new smd_bone[MAX_BONES];
            cant_cdmaterials = 0;
            cdmaterials      = new string[10];

            cargar(fname);
        }
Example #3
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();
        }