예제 #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();
 }
예제 #2
0
 public final void setWeapon(int weaponIndex) {
   weapon = weapons.get(weaponIndex);
   ViewFrame.getInstance().setWeapon(weapon.toString());
 }