package main;

import java.util.ArrayList;

import ea.Knoten;
import main.entities.player.Player;
import main.maps.ImageMap;
import main.maps.Map;

/**
 * Hier werden alle Maps gespeichert.
 */
public class World extends Knoten {

	public static final int SCALE_FACTOR = 6; // Der Basis Zoomfaktor
	public static final int SCALE = SCALE_FACTOR * Tile.getSize(); // Eine Gameunit ist so viele pixel lang

	private Map currentMap; // Die Map die aktuell angezeigt werden soll.
	private ArrayList<ImageMap> dungeon;
	
	private Player player;

	public World() {

		dungeon = new ArrayList<>(50);
		
		ImageMap start = new ImageMap("/res/images/maps/map1.png");
		dungeon.add(start);
		currentMap = start;
		
		start.generate(dungeon);
		
		
		player = new Player();
		currentMap.getEntities().add(player);
		currentMap.add(player.actionFigur);
		Main.instance.manager.anmelden(player, 20);
		
		add(currentMap);
		
	}
	
	public Map getCurrentMap() {
		return currentMap;
	}
	
	public Player getPlayer() {
		return player;
	}
	
	public void changeMap(DoorTile door) {
		entfernen(currentMap);
		currentMap = door.getMap();
		currentMap.add(player.actionFigur);
		add(currentMap);
		player.setPos(7, 5);
	}
}
