mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Wind arrow follows wind data
#story[1276]
This commit is contained in:
@@ -11,6 +11,7 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -82,6 +83,7 @@ public class GameState implements Runnable {
|
||||
|
||||
private static Long previousUpdateTime;
|
||||
public static Double windDirection;
|
||||
public static ReadOnlyDoubleWrapper windDirectionProperty = new ReadOnlyDoubleWrapper();
|
||||
private static Double windSpeed;
|
||||
private static Double serverSpeedMultiplier;
|
||||
|
||||
@@ -108,6 +110,7 @@ public class GameState implements Runnable {
|
||||
|
||||
public GameState() {
|
||||
windDirection = 180d;
|
||||
windDirectionProperty.set(windDirection);
|
||||
windSpeed = 10000d;
|
||||
yachts = new HashMap<>();
|
||||
tokensInPlay = new ArrayList<>();
|
||||
@@ -191,6 +194,7 @@ public class GameState implements Runnable {
|
||||
|
||||
public static void setWindDirection(Double newWindDirection) {
|
||||
windDirection = newWindDirection;
|
||||
windDirectionProperty.set(newWindDirection);
|
||||
}
|
||||
|
||||
public static void setWindSpeed(Double newWindSpeed) {
|
||||
@@ -509,6 +513,7 @@ public class GameState implements Runnable {
|
||||
Double optimalAngle = PolarTable.getOptimalAngle();
|
||||
Double heading = yacht.getHeading();
|
||||
windDirection = (double) Math.floorMod(Math.round(heading + optimalAngle), 360L);
|
||||
windDirectionProperty.set(windDirection);
|
||||
}
|
||||
|
||||
|
||||
@@ -1058,4 +1063,8 @@ public class GameState implements Runnable {
|
||||
public static void setTokensEnabled (boolean tokensEnabled) {
|
||||
GameState.tokensEnabled = tokensEnabled;
|
||||
}
|
||||
|
||||
public static ReadOnlyDoubleWrapper getWindDirectionProperty() {
|
||||
return windDirectionProperty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user