/// <summary> /// updates the Minimap and adds Items to the minimap /// </summary> /// <param name="itemMap"></param> /// <param name="player"></param> public void update(ItemMap itemMap, List<Player> player) { itemList.Clear(); for(int i = 0; i < Settings.getMapSizeX(); i++){ for (int j = 0; j < Settings.getMapSizeZ(); j++ ) { if (!itemMap.isEmpty(i, j)) { Icon h = itemMap.getItem(i, j).itemIcon; h.setPosition(new Vector2(miniMap[0, 0].getWidth() * i + position.X, miniMap[0, 0].getHeight() * j + position.Y)); h.setIndividualScale(individualScale); itemList.Add(h); } } } playerList.Clear(); foreach (Player p in player) { Icon h = p.playerIcon; h.setPosition(new Vector2(miniMap[0, 0].getWidth() * p.getPosition().X + position.X , miniMap[0, 0].getHeight() * p.getPosition().Z + position.Y )); h.setIndividualScale(individualScale); playerList.Add(h); } }
/// <summary> /// Initializes the Map, Items, the Player, the PlayerInterface and the Minimap /// </summary> public virtual void initialize() { mapCreator = new MapCreator(); mapCreator.initialize(); map = mapCreator.generateMap(); itemMap = new ItemMap(); itemSpawner = new ItemSpawner(); itemSpawner.initialSpawn(itemMap, map, playerList); initializePlayer(); minimap = new Minimap(new Vector2(0, 0), map); if (playerList.Count == 1) minimap.setPosition(new Vector2(Settings.getResolutionX() - minimap.getWidth(), 0)); else minimap.setPosition(new Vector2(Settings.getResolutionX() / 2 - minimap.getWidth() / 2, Settings.getResolutionY() / 2 - minimap.getHeight() / 2)); Game1.sounds.menuSound.Stop(); Game1.sounds.inGameSound.Play(); }