/** * Loads the specific dungeon level and displays it. If level 0 is loaded the town state will be shown. * todo: should this be dungeon states job? */ public static void LoadDungeonLevel(int newLevel) { Util.Assert(AllDataLoaded, "Data must be loaded before dungeon level."); Util.Assert(GraphicsLoaded, "Graphics must be loaded before dungeon level."); if ((newLevel < 0) || (newLevel >= CoM.Dungeon.Floor.Length)) { throw new Exception("Invalid level index to load " + newLevel); } if (newLevel == 0) { GetDungeonBuilder().SelectedMap = 0; EnableCamera = false; PushState(new TownState()); if (AutoGotoTemple) { PushState(new TempleState()); AutoGotoTemple = false; } } else { Trace.Log("Loading dungeon level " + newLevel + "/" + CoM.Dungeon.Floors); GetDungeonBuilder().SelectedMap = newLevel; EnableCamera = true; Culler.Initialize(Party, newLevel); } if (Instance.DungeonState != null) { Instance.DungeonState.AutoMap.Map = Party.ExploredMap; } Instance.CurrentDungeonLevel = newLevel; //stub: reset monsters State.ForceRespawn(); FPSCounter.Reset(); }