Updated the icons to be more uniform and transparent
#story[1293]
@@ -1,8 +1,6 @@
|
||||
package seng302.gameServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -26,8 +24,6 @@ import seng302.gameServer.messages.MarkRoundingMessage;
|
||||
import seng302.gameServer.messages.MarkType;
|
||||
import seng302.gameServer.messages.Message;
|
||||
import seng302.gameServer.messages.RoundingBoatStatus;
|
||||
import seng302.gameServer.messages.YachtEventCodeMessage;
|
||||
import seng302.gameServer.messages.YachtEventType;
|
||||
import seng302.model.GeoPoint;
|
||||
import seng302.model.Limit;
|
||||
import seng302.model.Player;
|
||||
@@ -359,8 +355,8 @@ public class GameState implements Runnable {
|
||||
*/
|
||||
private void spawnNewToken() {
|
||||
tokensInPlay.clear();
|
||||
Token token = randomSpawn.getRandomTokenLocation();
|
||||
// token.assignType(TokenType.WIND_WALKER);
|
||||
Token token = randomSpawn.getRandomToken();
|
||||
// token.assignType(TokenType.RANDOM);
|
||||
logger.debug("Spawned token of type " + token.getTokenType());
|
||||
tokensInPlay.add(token);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public class RandomSpawn {
|
||||
private static final Integer DEGREES_IN_CIRCLE = 360;
|
||||
|
||||
private HashMap<GeoPoint, Double> spawnRadii;
|
||||
private Object[] spawnCentres;
|
||||
private Random random;
|
||||
|
||||
/**
|
||||
@@ -27,6 +28,7 @@ public class RandomSpawn {
|
||||
random = new Random();
|
||||
|
||||
spawnRadii = generateSpawnRadii(markOrder);
|
||||
spawnCentres = spawnRadii.keySet().toArray();
|
||||
}
|
||||
|
||||
private HashMap<GeoPoint, Double> generateSpawnRadii(List<CompoundMark> markOrder) {
|
||||
@@ -48,9 +50,8 @@ public class RandomSpawn {
|
||||
* @return A random token type at a random location in a random radii of the set of possible
|
||||
* radii
|
||||
*/
|
||||
public Token getRandomTokenLocation() {
|
||||
Object[] keys = spawnRadii.keySet().toArray();
|
||||
GeoPoint randomSpawnCentre = (GeoPoint) keys[random.nextInt(keys.length)];
|
||||
public Token getRandomToken() {
|
||||
GeoPoint randomSpawnCentre = (GeoPoint) spawnCentres[random.nextInt(spawnCentres.length)];
|
||||
Double spawnRadius = spawnRadii.get(randomSpawnCentre);
|
||||
Double randomDistance = spawnRadius * random.nextDouble();
|
||||
Double randomAngle = random.nextDouble() * DEGREES_IN_CIRCLE;
|
||||
|
||||
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 8.8 KiB |
@@ -284,7 +284,7 @@
|
||||
GridPane.columnIndex="4" GridPane.halignment="CENTER"
|
||||
GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
||||
<image>
|
||||
<Image url="@../icons/ayy_lmao.gif"/>
|
||||
<Image url="@../icons/slowedIcon.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</children>
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RandomSpawnTest {
|
||||
.getDirtyMidPoint(compoundMark1.getMidPoint(), compoundMark2.getMidPoint());
|
||||
Double maxDistance = GeoUtility.getDistance(testMidPoint, compoundMark2.getMidPoint());
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
Token token = randomSpawn.getRandomTokenLocation();
|
||||
Token token = randomSpawn.getRandomToken();
|
||||
Double distanceFromCentreRadius = GeoUtility.getDistance(testMidPoint, token);
|
||||
assertTrue("Out of bounds token", distanceFromCentreRadius <= maxDistance);
|
||||
}
|
||||
|
||||