VMGCommand now toggles autoVMG on and off. Linked up observer and observable so the current boat can now be controlled.
#Story[1097]
This commit is contained in:
@@ -203,4 +203,8 @@ public class MockBoat extends Boat {
|
||||
public void setAutoVMG(boolean autoVMG) {
|
||||
this.autoVMG = autoVMG;
|
||||
}
|
||||
|
||||
public boolean getAutoVMG(){
|
||||
return autoVMG;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package mock.model.commandFactory;
|
||||
|
||||
import mock.model.MockBoat;
|
||||
import mock.model.MockRace;
|
||||
import shared.model.Bearing;
|
||||
|
||||
/**
|
||||
* Created by David on 2/08/2017.
|
||||
@@ -28,5 +29,6 @@ public class TackGybeCommand implements Command {
|
||||
if(race.improvesVelocity(boatVMG, newVMG, boat.calculateBearingToNextMarker())){
|
||||
boat.setVMG(newVMG);
|
||||
}*/
|
||||
this.boat.setBearing(Bearing.fromDegrees(360 - boat.getBearing().degrees()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,5 +25,12 @@ public class VMGCommand implements Command {
|
||||
Bearing.fromDegrees(0d),
|
||||
Bearing.fromDegrees(359.99999d));
|
||||
boat.setVMG(newVMG);*/
|
||||
if (boat.getAutoVMG()){
|
||||
boat.setAutoVMG(false);
|
||||
System.out.println("Auto VMG off!");
|
||||
} else {
|
||||
boat.setAutoVMG(true);
|
||||
System.out.println("Auto VMG on!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user