/// <summary> /// Change the current map, arriving at the given portal if any. /// </summary> /// <param name="contentName">The asset name of the new map.</param> /// <param name="originalPortal">The portal from the previous map.</param> public static void ChangeMap(string contentName, Portal originalPortal) { // make sure the content name is valid string mapContentName = contentName; if (!mapContentName.StartsWith(@"Maps\")) { mapContentName = Path.Combine(@"Maps", mapContentName); } // check for trivial movement - typically intra-map portals if ((Map != null) && (Map.Name == mapContentName)) { SetMap(Map, originalPortal == null ? null : Map.GetPortal(originalPortal.DestinationMap)); } // load the map changeMap = MapContentManager.Load<Map>(mapContentName); // modify the map based on the world changes (removed chests, etc.). //ModifyMap(map); // start playing the music for the new map //AudioManager.PlayMusic(map.MusicCueName); // set the new map into the tile engine SetMap(changeMap, originalPortal == null ? null : changeMap.GetPortal(originalPortal.DestinationPortal)); }