|
|
@ -7,6 +7,12 @@ public class VisualizerPlainText implements Visualizer { |
|
|
|
private String output; |
|
|
|
public final GameManager gameManager; |
|
|
|
|
|
|
|
public HashMap<String, String> sprites = new HashMap<String,String>(){{ |
|
|
|
this.put("empty", " "); |
|
|
|
this.put("dot", ". "); |
|
|
|
this.put("wall", "[]"); |
|
|
|
}}; |
|
|
|
|
|
|
|
public VisualizerPlainText(GameManager gameManager) { |
|
|
|
this.gameManager = gameManager; |
|
|
|
} |
|
|
@ -15,9 +21,26 @@ public class VisualizerPlainText implements Visualizer { |
|
|
|
public Object GetOutput() { |
|
|
|
return output; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void Update() { |
|
|
|
// TODO Auto-generated method stub |
|
|
|
output = ""; |
|
|
|
Map map = gameManager.map; |
|
|
|
|
|
|
|
for(int y = 0; y < map.size.y; y++) { |
|
|
|
for(int x = 0; x < map.size.x; x++) { |
|
|
|
Cell cell = map.GetCell(new Vector2(x,y)); |
|
|
|
|
|
|
|
if (sprites.containsKey(cell.type)) { |
|
|
|
|
|
|
|
output += sprites.get(cell.type); |
|
|
|
} |
|
|
|
else { |
|
|
|
System.out.println("unknown type" + cell.type); |
|
|
|
} |
|
|
|
} |
|
|
|
output += "\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |