Clean up changes

#story[1274]
This commit is contained in:
Kusal Ekanayake
2017-09-23 15:37:16 +12:00
parent e9b50038a9
commit 0a885dd8fd
2 changed files with 10 additions and 13 deletions
@@ -55,14 +55,14 @@ public class BoatCustomizeController implements Initializable{
private LobbyController lobbyController; private LobbyController lobbyController;
private BoatMeshType currentBoat; private BoatMeshType currentBoat;
private Double maxSpeedMultiplier = 1.0; private Double maxSpeedMultiplier = 1.0;
private Double maxTurnRate = 1.0; private Double maxTurnRateMultiplier = 1.0;
private Double maxAcceleration = 1.0; private Double maxAccelerationMultiplier = 1.0;
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
socketThread = ViewManager.getInstance().getGameClient().getServerThread(); socketThread = ViewManager.getInstance().getGameClient().getServerThread();
generateMaxStats(); findMaxStats();
RequiredFieldValidator playerNameReqValidator = new RequiredFieldValidator(); RequiredFieldValidator playerNameReqValidator = new RequiredFieldValidator();
playerNameReqValidator.setMessage("Player name required."); playerNameReqValidator.setMessage("Player name required.");
@@ -158,23 +158,23 @@ public class BoatCustomizeController implements Initializable{
refreshStatBars(currentBoat); refreshStatBars(currentBoat);
} }
private void generateMaxStats() { private void findMaxStats() {
for (BoatMeshType bmt: BoatMeshType.values()) { for (BoatMeshType bmt: BoatMeshType.values()) {
if (bmt.turnStep > maxTurnRate) { if (bmt.turnStep > maxTurnRateMultiplier) {
maxTurnRate = bmt.turnStep; maxTurnRateMultiplier = bmt.turnStep;
} }
if (bmt.maxSpeedMultiplier > maxSpeedMultiplier) { if (bmt.maxSpeedMultiplier > maxSpeedMultiplier) {
maxSpeedMultiplier = bmt.maxSpeedMultiplier; maxSpeedMultiplier = bmt.maxSpeedMultiplier;
} }
if (bmt.accelerationMultiplier > maxAcceleration) { if (bmt.accelerationMultiplier > maxAccelerationMultiplier) {
maxAcceleration = bmt.accelerationMultiplier; maxAccelerationMultiplier = bmt.accelerationMultiplier;
} }
} }
} }
private void refreshStatBars(BoatMeshType bo) { private void refreshStatBars(BoatMeshType bo) {
speedBar.setProgress((bo.maxSpeedMultiplier) / maxSpeedMultiplier); speedBar.setProgress((bo.maxSpeedMultiplier) / maxSpeedMultiplier);
accelBar.setProgress(bo.accelerationMultiplier / maxAcceleration); accelBar.setProgress(bo.accelerationMultiplier / maxAccelerationMultiplier);
handleBar.setProgress(bo.turnStep / maxTurnRate); handleBar.setProgress(bo.turnStep / maxTurnRateMultiplier);
} }
} }
@@ -18,9 +18,6 @@ public class BoatModel extends Model {
private static final int SAIL_INDEX = 2; private static final int SAIL_INDEX = 2;
private BoatMeshType meshType; private BoatMeshType meshType;
private Double maxSpeedMultiplier;
private Double turnStep;
private Double accelerationMultiplier;
/** /**
* Stores a model and it's optional animation. * Stores a model and it's optional animation.