mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Works for clients and server.
Due to the information being sent and received, it only currently works on client side boats. #story[1111]
This commit is contained in:
@@ -282,9 +282,6 @@ public class Yacht {
|
|||||||
this.velocityProperty.set(velocity);
|
this.velocityProperty.set(velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSailsInProperty(Boolean clientSails) {
|
|
||||||
this.clientSailsIn = clientSails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMarkRoundingTime(Long markRoundingTime) {
|
public void setMarkRoundingTime(Long markRoundingTime) {
|
||||||
this.markRoundTime = markRoundingTime;
|
this.markRoundTime = markRoundingTime;
|
||||||
@@ -407,7 +404,7 @@ public class Yacht {
|
|||||||
this.velocity = velocity;
|
this.velocity = velocity;
|
||||||
updateVelocityProperty(velocity);
|
updateVelocityProperty(velocity);
|
||||||
for (YachtLocationListener yll : locationListeners) {
|
for (YachtLocationListener yll : locationListeners) {
|
||||||
yll.notifyLocation(this, lat, lon, heading, velocity, this.clientSailsIn);
|
yll.notifyLocation(this, lat, lon, heading, velocity, clientSailsIn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,21 +90,14 @@ public class BoatObject extends Group {
|
|||||||
|
|
||||||
// annotationBox = new AnnotationBox();
|
// annotationBox = new AnnotationBox();
|
||||||
// annotationBox.setFill(colour);
|
// annotationBox.setFill(colour);
|
||||||
sail = new Polygon(0.0, BOAT_HEIGHT / 4,
|
|
||||||
0.0, BOAT_HEIGHT);
|
|
||||||
sailState = 0;
|
|
||||||
sail.setStrokeWidth(2.0);
|
|
||||||
sail.setStroke(Color.SILVER);
|
|
||||||
sail.setFill(Color.TRANSPARENT);
|
|
||||||
sail.setCache(true);
|
|
||||||
animateSail();
|
|
||||||
leftLayLine = new Line();
|
leftLayLine = new Line();
|
||||||
rightLayline = new Line();
|
rightLayline = new Line();
|
||||||
trail.getStrokeDashArray().setAll(5d, 10d);
|
trail.getStrokeDashArray().setAll(5d, 10d);
|
||||||
trail.setCache(true);
|
trail.setCache(true);
|
||||||
wake = new Wake(0, -BOAT_HEIGHT);
|
wake = new Wake(0, -BOAT_HEIGHT);
|
||||||
wake.setVisible(true);
|
wake.setVisible(true);
|
||||||
super.getChildren().addAll(boatPoly, sail);//, annotationBox);
|
super.getChildren().addAll(boatPoly);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFill (Paint value) {
|
public void setFill (Paint value) {
|
||||||
@@ -128,15 +121,16 @@ public class BoatObject extends Group {
|
|||||||
rotateTo(rotation, sailIn);
|
rotateTo(rotation, sailIn);
|
||||||
boatPoly.setLayoutX(x);
|
boatPoly.setLayoutX(x);
|
||||||
boatPoly.setLayoutY(y);
|
boatPoly.setLayoutY(y);
|
||||||
sail.setLayoutX(x);
|
if (isPlayer && !sailIn) {
|
||||||
sail.setLayoutY(y);
|
|
||||||
if (!sailIn) {
|
|
||||||
animateSail();
|
animateSail();
|
||||||
} else {
|
sail.setLayoutX(x);
|
||||||
|
sail.setLayoutY(y);
|
||||||
|
} else if (isPlayer){
|
||||||
sail.getPoints().clear();
|
sail.getPoints().clear();
|
||||||
sail.getPoints().addAll(0.0,BOAT_HEIGHT / 4,
|
sail.getPoints().addAll(0.0,BOAT_HEIGHT / 4,
|
||||||
0.0, BOAT_HEIGHT);
|
0.0, BOAT_HEIGHT);
|
||||||
|
sail.setLayoutX(x);
|
||||||
|
sail.setLayoutY(y);
|
||||||
}
|
}
|
||||||
wake.setLayoutX(x);
|
wake.setLayoutX(x);
|
||||||
wake.setLayoutY(y);
|
wake.setLayoutY(y);
|
||||||
@@ -164,10 +158,10 @@ public class BoatObject extends Group {
|
|||||||
|
|
||||||
private void rotateTo(double rotation, boolean sailsIn) {
|
private void rotateTo(double rotation, boolean sailsIn) {
|
||||||
boatPoly.getTransforms().setAll(new Rotate(rotation));
|
boatPoly.getTransforms().setAll(new Rotate(rotation));
|
||||||
if (sailsIn) {
|
if (isPlayer && sailsIn) {
|
||||||
sail.getTransforms().setAll(new Rotate(GameState.getWindDirection() + 95.0));
|
sail.getTransforms().setAll(new Rotate(95.0));
|
||||||
} else {
|
} else if (isPlayer){
|
||||||
sail.getTransforms().setAll(new Rotate(GameState.getWindDirection()));
|
sail.getTransforms().setAll(new Rotate(90.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void animateSail(){
|
private void animateSail(){
|
||||||
@@ -311,6 +305,16 @@ public class BoatObject extends Group {
|
|||||||
boatPoly.setStroke(Color.BLACK);
|
boatPoly.setStroke(Color.BLACK);
|
||||||
boatPoly.setStrokeWidth(3);
|
boatPoly.setStrokeWidth(3);
|
||||||
isPlayer = true;
|
isPlayer = true;
|
||||||
|
sail = new Polygon(0.0, BOAT_HEIGHT / 4,
|
||||||
|
0.0, BOAT_HEIGHT);
|
||||||
|
sailState = 0;
|
||||||
|
sail.setStrokeWidth(2.0);
|
||||||
|
sail.setStroke(Color.BLACK);
|
||||||
|
sail.setFill(Color.TRANSPARENT);
|
||||||
|
sail.setCache(true);
|
||||||
|
super.getChildren().clear();
|
||||||
|
super.getChildren().addAll(boatPoly, sail);
|
||||||
|
animateSail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrajectory(double heading, double velocity) {
|
public void setTrajectory(double heading, double velocity) {
|
||||||
|
|||||||
Reference in New Issue
Block a user