コード例 #1
0
 public WeaponStock(string nm, int acc, int wei, int att, int rel, int cli, string typ, int fr, Rectangle loc)
 {
     name = nm;
     accuracy = acc;
     weight = wei;
     attackPower = att;
     reloadSpeed = rel;
     clipCapacity = cli;
     type = typ;
     fireRate = fr;
     location = loc;
     clip = new GunClip(reloadSpeed, clipCapacity, new Rectangle(0,0,0,0));
 }
コード例 #2
0
        public WeaponCustomizable(GunBody bdy, GunBarrel brrl, GunStock stck, GunClip clp)
        {
            barrel = brrl;
            body = bdy;
            stock = stck;
            clip = clp;

            accuracy += barrel.Accuracy + body.Accuracy + stock.Accuracy;
            weight += barrel.Weight + body.Weight + stock.Weight;
            attackPower += barrel.AttackPower + body.AttackPower;
            fireRate += body.FireRate;
            reloadSpeed += body.ReloadSpeed + clip.ReloadSpeed;
            clipCapacity += body.ClipCapacity + clip.ClipCapacity;
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: RIT-GSD3-Survive/Survive
 private void SwitchCurrentClip()
 {
     //put current ammo into new gun
     int leftOverAmmo = currentClip.Current;
     if (leftOverAmmo > currentWeapon.ClipCapacity) //too much ammo for current clip, convert back to ammo
     {
         int excessAmmo = leftOverAmmo - currentWeapon.ClipCapacity;
         ammo += excessAmmo;
         leftOverAmmo -= excessAmmo;
     }
     currentClip = currentWeapon.Clip;
     currentClip.Current = leftOverAmmo;
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: RIT-GSD3-Survive/Survive
 public void SwitchWeaponsPrevious()
 {
     reloading = false;
     reloadTimer = 0;
     weaponIndex -= 1;
     if (weaponIndex < 0)
     {
         weaponIndex = weapons.Count - 1;
     }
     currentWeapon = weapons[weaponIndex];
     fireRateTimer = 100 / currentWeapon.FireRate;
     if (currentWeapon.Weight >= 0 && currentWeapon.Weight <= 5)
     {
         moveSpeed = 4;
     }
     else if (currentWeapon.Weight >= 6 && currentWeapon.Weight <= 10)
     {
         moveSpeed = 3;
     }
     else if (currentWeapon.Weight >= 11 && currentWeapon.Weight <= 15)
     {
         moveSpeed = 2;
     }
     else if (currentWeapon.Weight >= 16 && currentWeapon.Weight <= 20)
     {
         moveSpeed = 1;
     }
     currentClip = currentWeapon.Clip;
     //SwitchCurrentClip();
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: RIT-GSD3-Survive/Survive
 // methods
 //call in the constructors so we don't have have duplicate lines in each
 public void SetUp(string nm, Rectangle loc)
 {
     tBackend = new Tinkering.TinkerBackend(this);
     reloading = false;
     healingItemsAmount = 0;
     score = 0;
     ammo = 1000;
     name = nm;
     items = new List<GunBits>();
     weapons = new List<Weapon>();
     weaponIndex = 0;
     weapons.Add(new WeaponStock("Beginner's Pistol", 75, 1, 10, 5, 1, "Pistol", 10, new Rectangle(0,0,0,0)));
     currentWeapon = weapons[weaponIndex];
     currentClip = new GunClip(currentWeapon.ReloadSpeed, currentWeapon.ClipCapacity, new Rectangle(0,0,0,0));
     nextClip = null;
     currentClip.Current = currentClip.ClipCapacity;
     fireRateTimer = 100 / CurrentWeapon.FireRate;
     moveSpeed = 4;
     reloadTimer = 0;
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: RIT-GSD3-Survive/Survive
 public void Reload()
 {
     if(GlobalVariables.map.AtSafehouse) return;
     reloading = true;
     //check for filled clips
     if (reloadTimer >= (nextClip.ReloadSpeed*60))
     {
         currentClip = nextClip;
         nextClip = null;
         reloadTimer = 0;
         reloading = false;
     }
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: RIT-GSD3-Survive/Survive
        public void FindNextBestClip()
        {
            if (nextClip == null)
            {
                GunClip best = null;
                foreach (GunBits gunbit in items)
                {
                    if (gunbit is GunClip)
                    {
                        if (best == null)
                            best = (GunClip)gunbit;
                        else
                            if (((GunClip)gunbit).Current > best.Current)
                                best = (GunClip)gunbit;
                    }
                }

                if (best != null) //best clip found
                {
                    nextClip = best;
                }
            }
        }