Implemented toString in Stargate

This commit is contained in:
Bokros Bálint 2016-04-25 21:33:07 +02:00
parent 70fd002f47
commit afbca7b80b

View File

@ -1,17 +1,19 @@
package cicaprojekt; package cicaprojekt;
public class Stargate { public class Stargate {
public static final Stargate yellowStargate = new Stargate(); public static final Stargate yellowStargate = new Stargate("Yellow Stargate");
public static final Stargate blueStargate = new Stargate(); public static final Stargate blueStargate = new Stargate("Blue Stargate");
public static final Stargate redStargate = new Stargate(); public static final Stargate redStargate = new Stargate("Red Stargate");
public static final Stargate greenStargate = new Stargate(); public static final Stargate greenStargate = new Stargate("Green Stargate");
public /*final*/ Stargate other; //TODO find better ways to do this public /*final*/ Stargate other; //TODO find better ways to do this
private boolean isSpawned; private boolean isSpawned;
private Wall currentWall; private Wall currentWall;
private String name;
private Stargate() { private Stargate(String name) {
isSpawned = false; isSpawned = false;
this.name = name;
} }
public static void init() { public static void init() {
@ -35,4 +37,9 @@ public class Stargate {
public void teleport(Direction incomingDirection) { public void teleport(Direction incomingDirection) {
} }
@Override
public String toString() {
return String.format("%s: %s", name, currentWall);
}
} }