RaceController can now set up collision listeners on each boat.
#story[1195]
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package visualiser.model;
|
||||
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.scene.paint.Color;
|
||||
import network.Messages.Enums.BoatStatusEnum;
|
||||
@@ -62,6 +64,7 @@ public class VisualiserBoat extends Boat {
|
||||
|
||||
private ObjectProperty<GPSCoordinate> positionProperty;
|
||||
private ObjectProperty<Bearing> bearingProperty;
|
||||
private BooleanProperty hasCollided;
|
||||
|
||||
|
||||
/**
|
||||
@@ -74,6 +77,7 @@ public class VisualiserBoat extends Boat {
|
||||
super(boat.getSourceID(), boat.getName(), boat.getCountry());
|
||||
|
||||
this.color = color;
|
||||
this.hasCollided = new SimpleBooleanProperty(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,10 +257,6 @@ public class VisualiserBoat extends Boat {
|
||||
this.positionProperty.set(position);
|
||||
}
|
||||
|
||||
public ObjectProperty<GPSCoordinate> positionProperty() {
|
||||
return positionProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bearing getBearing() {
|
||||
return bearingProperty.get();
|
||||
@@ -270,7 +270,15 @@ public class VisualiserBoat extends Boat {
|
||||
this.bearingProperty.set(bearing);
|
||||
}
|
||||
|
||||
public ObjectProperty<Bearing> bearingProperty() {
|
||||
return bearingProperty;
|
||||
public boolean hasCollided() {
|
||||
return hasCollided.get();
|
||||
}
|
||||
|
||||
public BooleanProperty hasCollidedProperty() {
|
||||
return hasCollided;
|
||||
}
|
||||
|
||||
public void setHasCollided(boolean hasCollided) {
|
||||
this.hasCollided.set(hasCollided);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user