public final void cycleWeapon(int direction) { do { weaponIndex += direction; if (weaponIndex < 0) { weaponIndex = weapons.size() - 1; } else if (weaponIndex >= weapons.size()) { weaponIndex = 0; } weapon = weapons.get(weaponIndex); } while (weapon.getAmmo() + weapon.getRounds() == 0); ViewFrame.getInstance().setWeapon(weapon.toString()); displayAmmo(); }
private void displayAmmo() { ViewFrame.getInstance().setAmmo(weapon.getRounds(), weapon.getClipSize(), weapon.getAmmo()); }
public final void reload() { if (weapon.getAmmo() > 0) { weapon.reload(); displayAmmo(); } }