Ejemplo n.º 1
0
        private static Weapon getActualWeapon(PrimitiveWeapon primWep, PrimitiveIteamWeaponInfo info)
        {
            switch (primWep.wi_weapon_type)
            {
            case WeaponType.Melee:
                return(handleMeleeCase(primWep, info));

            case WeaponType.Rifle:
                return(handleCaseRifle(primWep, info));

            case WeaponType.Shotgun:
                return(handleCaseShotgun(primWep, info));

            case WeaponType.Sniper:
                return(handleCaseSniper(primWep, info));

            case WeaponType.Minigun:
                return(handleCaseMinigun(primWep, info));

            case WeaponType.Bazooka:
                return(handleCaseBazooka(primWep, info));

            case WeaponType.Grenade:
                return(handleCaseGrenade(primWep, info));

            default:
                throw new ArgumentException("Illegal weapon type");
            }
        }
Ejemplo n.º 2
0
        private static Weapon handleMeleeCase(PrimitiveWeapon primWep, PrimitiveIteamWeaponInfo info)
        {
            Weapon wep = new Melee(primWep.wi_ability_a, primWep.wi_ability_b,
                                   primWep.wi_ability_c, primWep.wi_ability_d);

            setWeaponStats(wep, primWep, info);
            return(wep);
        }
Ejemplo n.º 3
0
 private static void setWeaponStats(Weapon wep, PrimitiveWeapon primWep, PrimitiveIteamWeaponInfo info)
 {
     wep.Id          = primWep.wi_id;
     wep.Description = info.ii_desc;
     wep.Name        = info.ii_name;
     wep.MeshPath    = info.ii_meshfilename;
     wep.AmmoClip    = primWep.wi_bullet_capacity;
     wep.TotalAmmo   = primWep.wi_bullet_total;
     wep.ChangeTime  = primWep.wi_change_time;
     foreach (var icon in  primIcons)
     {
         if (icon.ii_id == info.ii_icon)
         {
             wep.IconFile = icon.ii_filename;
             break;
         }
     }
 }