Beispiel #1
0
 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();
 }
Beispiel #2
0
 private void displayAmmo() {
   ViewFrame.getInstance().setAmmo(weapon.getRounds(), weapon.getClipSize(), weapon.getAmmo());
 }
Beispiel #3
0
 public final void reload() {
   if (weapon.getAmmo() > 0) {
     weapon.reload();
     displayAmmo();
   }
 }