public WeaponGui(Team team) { super(VERTEX_TEXTURE, false, TOTAL_ELEMENTS); this.team = team; weaponOverlay = new WeaponGuiOverlay(team.getWeapons()); generateVertexData(); generateTextureData(); chosenWeapon = team.getActiveCube().getSelectedWeaponIndex(); }
@Override public void onTick() { if (GameKeyboard.getInstance().isKeyPressed(Keyboard.KEY_RIGHT)) { if (chosenWeapon + 1 < team.getWeapons().length) { ++chosenWeapon; generateVertexData(); } } if (GameKeyboard.getInstance().isKeyPressed(Keyboard.KEY_LEFT)) { if (chosenWeapon - 1 >= 0) { --chosenWeapon; generateVertexData(); } } if (GameKeyboard.getInstance().isKeyPressed(Keyboard.KEY_RETURN)) { team.getActiveCube().setSelectedWeaponIndex(chosenWeapon); team.closeWeaponMenu(); } }