public void throwStone() { double speed = ui.getSpeed(); speed = Math.pow(speed, 1.5); double v = (1.0 - speed) * 2.3 + 3.0 * speed; Vect2d broom = new Vect2d(world.getBroomX(), world.getBroomY()); Vect2d dir = broom.minus(CurlingConstants.STONE_START).normalized(); Vect2d vel = dir.times(v); double da = 1.0; if (!ui.isHandRight()) { da = -da; } currentStone = new Stone(CurlingConstants.STONE_START, vel, 0, da, game.getMatchCtrl().getCurrentTeam()); double sweep = ui.getSelectedSweep(); currentStone.setSweep(sweep); logger.info("New stone: " + currentStone); world.addStone(currentStone); game.sendNewStone(currentStone); ui.endTurn(); }
public void stoneAdded(Stone stone) { world.addStone(stone); }