|
@ -7,6 +7,12 @@ public class VisualizerPlainText implements Visualizer { |
|
|
private String output; |
|
|
private String output; |
|
|
public final GameManager gameManager; |
|
|
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) { |
|
|
public VisualizerPlainText(GameManager gameManager) { |
|
|
this.gameManager = gameManager; |
|
|
this.gameManager = gameManager; |
|
|
} |
|
|
} |
|
@ -18,6 +24,23 @@ public class VisualizerPlainText implements Visualizer { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void Update() { |
|
|
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"; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |