Added a map to Stargate

This commit is contained in:
Bokros Bálint 2016-05-07 17:40:30 +02:00
parent ed45c604a4
commit 070d3ef3f4

View File

@ -1,5 +1,9 @@
package cicaprojekt; package cicaprojekt;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
public class Stargate { public class Stargate {
public static final Stargate yellowStargate = new Stargate("Yellow Stargate"); public static final Stargate yellowStargate = new Stargate("Yellow Stargate");
public static final Stargate blueStargate = new Stargate("Blue Stargate"); public static final Stargate blueStargate = new Stargate("Blue Stargate");
@ -10,6 +14,8 @@ public class Stargate {
private Wall currentWall; private Wall currentWall;
private String name; private String name;
private static Map<Color, Stargate> stargates = new HashMap<>();
private Stargate(String name) { private Stargate(String name) {
isSpawned = false; isSpawned = false;
@ -21,6 +27,15 @@ public class Stargate {
blueStargate.other = yellowStargate; blueStargate.other = yellowStargate;
redStargate.other = greenStargate; redStargate.other = greenStargate;
greenStargate.other = redStargate; greenStargate.other = redStargate;
stargates.put(Color.YELLOW, yellowStargate);
stargates.put(Color.BLUE, blueStargate);
stargates.put(Color.RED, redStargate);
stargates.put(Color.GREEN, greenStargate);
}
public static Stargate get(Color color) {
return stargates.get(color);
} }
public Wall getCurrentWall() { public Wall getCurrentWall() {