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(); }
// 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; }