Arrows work. mark arrow thinner. refactored marker class.

#fix
This commit is contained in:
Calum
2017-09-28 16:01:24 +13:00
parent 6d0835b0cf
commit 0231c43a2c
11 changed files with 88 additions and 109 deletions
@@ -11,8 +11,6 @@ import seng302.model.ClientYacht;
import seng302.model.Limit;
import seng302.model.mark.CompoundMark;
import seng302.model.mark.Corner;
import seng302.model.mark.Mark;
import seng302.utilities.Sounds;
/**
* Class converts a map preview to a minimap by adding boats.
@@ -20,15 +18,9 @@ import seng302.utilities.Sounds;
public class MiniMap extends MapPreview {
private HashMap<ClientYacht, Polygon> boatIcons = new HashMap<>();
private Polygon playerBoat;
private double playerRotation;
private List<ClientYacht> boats;
private ClientYacht player;
public MiniMap (List<CompoundMark> marks, List<Corner> course, List<Limit> border, List<ClientYacht> boats, ClientYacht player) {
super(marks, course, border);
this.boats = boats;
this.player = player;
setBoats(boats);
player.addMarkRoundingListener(this::updateMarkArrows);
}
@@ -56,31 +48,4 @@ public class MiniMap extends MapPreview {
gameObjects.getChildren().addAll(boatIcons.values());
});
}
private void updateMarkArrows (ClientYacht yacht, int legNumber) {
CompoundMark compoundMark;
if (legNumber - 1 >= 0) {
Sounds.playMarkRoundingSound();
compoundMark = course.get(legNumber-1);
for (Mark mark : compoundMark.getMarks()) {
markerObjects.get(mark).showNextExitArrow();
}
}
CompoundMark nextMark = null;
if (legNumber < course.size() - 1) {
Sounds.playMarkRoundingSound();
nextMark = course.get(legNumber);
for (Mark mark : nextMark.getMarks()) {
markerObjects.get(mark).showNextEnterArrow();
}
}
if (legNumber - 2 >= 0) {
CompoundMark lastMark = course.get(Math.max(0, legNumber - 2));
if (lastMark != nextMark) {
for (Mark mark : lastMark.getMarks()) {
markerObjects.get(mark).hideAllArrows();
}
}
}
}
}