public void SetWorld(String name, String startLoc, bool UseStartLocation) { if (!this.WorldsList.ContainsKey(name)) return; this.CurrentWorld = this.WorldsList[name]; TileEngine.ClearCurrentMapChunk(); //TileEngine.Player.StopMoving(); if (UseStartLocation) { if (startLoc == null || startLoc == "Default") TileEngine.Player.Location = this.CurrentWorld.FindDefaultStartLocation(); else TileEngine.Player.Location = this.CurrentWorld.FindStartLocation(startLoc); } if(!TileEngine.Camera.ManualControl) TileEngine.Camera.CenterOnCharacter(TileEngine.Player); }
public void CleanUp() { // I think this should be named Clear cache as a standard this.WorldsList.Clear(); this.CurrentWorld = null; }
public void Load(FileInfo WorldConfiguration, IMapProvider mapprovider, MapEventManager eventmanager) { XmlDocument doc = new XmlDocument(); doc.Load(WorldConfiguration.FullName); this.FileName = WorldConfiguration.Name; this.FilePath = WorldConfiguration.FullName; XmlNodeList worldNodes = doc.GetElementsByTagName("Worlds"); foreach (XmlNode worldNode in worldNodes[0].ChildNodes) { World world = new World(); world.Load(worldNode, mapprovider, eventmanager); this.WorldsList.Add(world.Name, world); } }