Esempio n. 1
0
 internal TGCGame()
 {
     game = this;
     new GraphicsDeviceManager(this);
     // Graphics.IsFullScreen = true;
     Content.RootDirectory = "Content";
 }
Esempio n. 2
0
 public Xwing()
 {
     HP          = 100;
     Score       = 0;
     ScaleMatrix = Matrix.CreateScale(2.5f);
     Game        = TGCGame.Instance;
 }
Esempio n. 3
0
        public Matrix getTransform()
        {
            var W = weapons[cur_weapon];

            return
                (Matrix.CreateScale(W.scale) *
                 Matrix.CreateRotationY(W.pitch * MathF.PI / 180.0f) *
                 Matrix.CreateRotationX(W.yaw * MathF.PI / 180.0f) *
                 Matrix.CreateTranslation(W.desf + new Vector3(0, 0, MathF.Sin(game.player.dist * 0.07f))) *
                 TGCGame.CalcularMatrizOrientacion(1.0f, game.camPosition, game.player.Direction));
        }
        public ExplosionAnim(Vector3 position)
        {
            Game   = TGCGame.Instance;
            rawPos = position;
            //var scl = MathHelper.Lerp(0f, 1f, 1 - (Vector3.Distance(position, Game.Xwing.Position) / 500));
            var scl = 1f;

            size   = sectorSize * scl;
            scale  = scl;
            center = Game.HUD.center;
        }
 /// <summary>
 ///     Constructor del juego.
 /// </summary>
 public TGCGame()
 {
     // Maneja la configuracion y la administracion del dispositivo grafico.
     Graphics = new GraphicsDeviceManager(this);
     // Descomentar para que el juego sea pantalla completa.
     // Graphics.IsFullScreen = true;
     // Carpeta raiz donde va a estar toda la Media.
     Content.RootDirectory = "Content";
     Instance = this;
     Xwing    = new Xwing();
     Gizmos   = new Gizmos();
 }
Esempio n. 6
0
        public void Init()
        {
            Game           = TGCGame.Instance;
            GraphicsDevice = Game.GraphicsDevice;
            Content        = Game.Content;

            ContentFolder3D       = TGCGame.ContentFolder3D;
            ContentFolderEffects  = TGCGame.ContentFolderEffects;
            ContentFolderTextures = TGCGame.ContentFolderTextures;

            SpriteBatch = new SpriteBatch(GraphicsDevice);
            LoadContent();
        }
        public LightCamera(float aspectRatio, Vector3 position) : base(aspectRatio)
        {
            Game     = TGCGame.Instance;
            Position = position;

            //FrontDirection = Vector3.Normalize(Game.Xwing.Position - Position);
            FrontDirection = new Vector3(-0.86602545f, -0.5f, 0f);
            RightDirection = Vector3.Normalize(Vector3.Cross(FrontDirection, Vector3.Up));
            UpDirection    = Vector3.Normalize(Vector3.Cross(RightDirection, FrontDirection));

            NearPlane = 250f;
            FarPlane  = 900f;
            CalculateProjection();
        }
        public Laser(Vector3 pos, Matrix rotation, Matrix srt, Vector3 fd, Vector3 c)
        {
            Position       = pos;
            SRT            = srt;
            FrontDirection = fd;
            Color          = c;

            Game = TGCGame.Instance;
            //BoundingCylinder = new BoundingCylinder(Position, 10f, 20f);
            //BoundingCylinder.Rotation = rotation;

            var tempAABB = BoundingVolumesExtensions.CreateAABBFrom(Game.Drawer.LaserModel);

            tempAABB                = BoundingVolumesExtensions.Scale(tempAABB, 0.3f);
            BoundingBox             = OrientedBoundingBox.FromAABB(tempAABB);
            BoundingBox.Center      = pos;
            BoundingBox.Orientation = rotation;
        }
Esempio n. 9
0
        public CEnemy(CBspFile p_scene, TGCGame p_game, CSMDModel p_model) : base(p_scene, p_game)
        {
            model      = p_model;
            vel_lineal = model.speed;

            //  0 "ValveBiped.Bip01_Pelvis" -1
            // 13 "ValveBiped.Bip01_Neck1" 12
            // 14 "ValveBiped.Bip01_Head1" 13
            // 45 "ValveBiped.weapon_bone" 9
            int[]   ndx_hp = { 0, 13, 14, 45 };
            float[] hp_dw  = { 10, 5, 5, 5 };
            for (int i = 0; i < cant_hp; ++i)
            {
                hit_points[i]          = new hit_point();
                hit_points[i].Position = new Vector3();
                hit_points[i].bone_id  = ndx_hp[i];
                hit_points[i].dw       = hp_dw[i];
            }
        }
Esempio n. 10
0
 public BackgroundCombat()
 {
     Game = TGCGame.Instance;
 }
Esempio n. 11
0
        public CWeapon(TGCGame p_game, GraphicsDevice p_device, ContentManager p_content, string p_folder)
        {
            game      = p_game;
            device    = p_device;
            Content   = p_content;
            cs_folder = p_folder;

            // Arma
            String[] W =
            {
                "v_pist_usp",       "idle",       "reload",       "shoot1",
                "v_pist_glock18",   "glock_idle", "glock_reload", "glock_firesingle",
                "v_pist_fiveseven", "idle",       "reload",       "shoot1",
                "v_pist_elite",     "idle",       "reload",       "shoot_left1",
                "v_357",            "idle01",     "reload",       "fire",
                "v_snip_awp",       "awm_idle",   "awm_reload",   "awm_fire",
                "v_smg_mp5",        "idle",       "reload1",      "shoot1",
                "v_smg_mac10",      "mac10_idle", "mac10_reload", "mac10_fire",
                "v_shot_m3super90", "idle",       "start_reload", "shoot1",
                "v_rif_sg552",      "idle",       "reload",       "shoot1",
                "v_rif_m4a1",       "idle",       "reload",       "shoot1",
                "v_rif_famas",      "idle",       "reload",       "shoot1",
                "v_rif_aug",        "idle",       "reload",       "shoot1",
                "v_rif_ak47",       "ak47_idle",  "ak47_reload",  "ak47_fire1",
                "v_rif_galil",      "idle",       "reload",       "shoot1",
                "v_pist_deagle",    "idle1",      "reload",       "shoot1",
                "v_knife_t",        "idle",       "draw",         "stab"
            };

            int t = 0;

            while (t < W.Length)
            {
                String weapon_name = W[t++];
                String file_name   = "weapons\\" + weapon_name + "\\" + weapon_name;
                weapons[cant_weapons++] = new weapon_reference(file_name, device, Content, cs_folder,
                                                               W[t++], W[t++], W[t++]);
            }


            int k = 0;


            //v_pist_usp
            weapons[k].pitch             = 73;
            weapons[k].yaw               = 14;
            weapons[k].desf              = new Vector3(-4.7f, -4, -4);
            weapons[k].scale             = new Vector3(1, 1, -1);
            weapons[k].muzzle_attachment = 1;
            weapons[k].muzzle_pos        = new Vector3(0, 2.75f, 6.5f);
            k++;

            // v_pist_glock18
            weapons[k].pitch             = 73;
            weapons[k].yaw               = 14;
            weapons[k].desf              = new Vector3(-4.7f, -4, -4);
            weapons[k].scale             = new Vector3(1, 1, -1);
            weapons[k].muzzle_attachment = 4;
            weapons[k].muzzle_pos        = new Vector3(0, 0, 6);
            k++;

            // v_pist_fiveseven
            weapons[k].pitch             = 73;
            weapons[k].yaw               = 14;
            weapons[k].desf              = new Vector3(-4.7f, -4, -4);
            weapons[k].scale             = new Vector3(1, 1, -1);
            weapons[k].muzzle_attachment = 1;
            weapons[k].muzzle_pos        = new Vector3(0, 2.2f, 7.5f);
            k++;


            // v_pist_elite
            weapons[k].pitch             = 73;
            weapons[k].yaw               = 14;
            weapons[k].desf              = new Vector3(-4.7f, -4, -4);
            weapons[k].scale             = new Vector3(1, 1, -1);
            weapons[k].muzzle_attachment = 22;
            k++;

            //v_357
            weapons[k].pitch             = 73;
            weapons[k].yaw               = 14;
            weapons[k].desf              = new Vector3(-17, -6, -3);
            weapons[k].scale             = new Vector3(1, 1, -1);
            weapons[k].muzzle_attachment = 22;
            k++;

            //v_snip_awp
            weapons[k].pitch      = 73;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-4.7f, -4, -4);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(0, 3.5f, 28);
            k++;

            //v_smg_mp5
            weapons[k].pitch      = 73;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-4.7f, -4, -4);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(3, 6, 27.5f);
            k++;

            //v_smg_mac10
            weapons[k].pitch      = 73;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-4.7f, -4, -4);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(0, 3, 5);
            k++;

            // v_shot_m3super90
            weapons[k].pitch      = 73;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-4.7f, -4, -4);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(2.724713f, 2.405631f, 16.455919f) + new Vector3(0, 3, 18);
            k++;

            //v_rif_sg552
            weapons[k].pitch      = 73;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-4.7f, -4, -4);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(3, 5.5f, 34);
            k++;

            //v_rif_m4a1
            weapons[k].pitch      = 73;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-4.7f, -4, -4);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(0.20f, 3.50f, 20.00f);
            k++;

            // famas
            weapons[k].pitch      = 79;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-11, -3, -9);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(-7.7f, 0, 12f);
            k++;

            // aug
            weapons[k].pitch      = 76;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-5, -6, -15);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(-1.70f, 2.70f, 15.00f);
            k++;

            // ak47
            weapons[k].pitch      = 76;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-5, -6, -15);
            weapons[k].scale      = new Vector3(1, 1, -1);
            weapons[k].muzzle_pos = new Vector3(0, 3.50f, 19.00f);
            k++;

            // galil
            weapons[k].pitch      = 76;
            weapons[k].yaw        = 14;
            weapons[k].desf       = new Vector3(-5, -6, -15);
            weapons[k].muzzle_pos = new Vector3(1.6f, 3.87f, 31);
            k++;

            // pist Eagle
            weapons[k].pitch      = 71;
            weapons[k].yaw        = 10;
            weapons[k].desf       = new Vector3(-14, -1.5f, -14);
            weapons[k].muzzle_pos = new Vector3(0, 2.75f, 6.50f);
            //weapons[k].model.anim[2].frameRate = 10;


            // correccion muzzle_pos
            for (int i = 0; i < cant_weapons; ++i)
            {
                weapons[i].muzzle_pos = new Vector3(weapons[i].muzzle_pos.X, -weapons[i].muzzle_pos.Z, weapons[i].muzzle_pos.Y);
            }

            // otros efectos
            sp             = new CSprite("effects\\muzzleflashx", device, Content);
            sp.rendercolor = new Vector3(1, 1, 1);
            sp.scale       = 0.1f;
            sp.renderamt   = 1;


            cur_weapon = 9;
        }
Esempio n. 12
0
 public CPlayer(CBspFile p_scene, TGCGame p_game)
 {
     scene  = p_scene;
     game   = p_game;
     Height = p_game.soldier_height;
 }
Esempio n. 13
0
 static void Main()
 {
     using (var game = new TGCGame())
         game.Run();
 }
Esempio n. 14
0
 public HUD(TGCGame instance)
 {
     Game        = instance;
     SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
 }
 public Input(TGCGame instance)
 {
     Game = instance;
 }