public World() { NPCs.Clear(); Signs.Clear(); Chests.Clear(); CharacterNames.Clear(); }
public void Clear() { Simulation.Clear(); NPCs.Clear(); Units.Clear(); Invalidate(); }
public World() { NPCs.Clear(); Signs.Clear(); Chests.Clear(); CharacterNames.Clear(); TileFrameImportant = SettingsTileFrameImportant.ToArray(); // clone for "new" world. Loaded worlds will replace this with file data }
/// <summary> /// Removes all light objects. /// </summary> public void Clear() { WaterPlanes.Clear(); Objects.Clear(); NPCs.Clear(); Buildings.Clear(); Sounds.Clear(); Effects.Clear(); Animations.Clear(); MonsterSpawns.Clear(); WarpPoints.Clear(); CollisionObjects.Clear(); EventObjects.Clear(); }
public void LoadRoom(string roomName) { Enemies.Clear(); Blocks.Clear(); Items.Clear(); NPCs.Clear(); Doors.Clear(); Walls.Clear(); HiddenItems.Clear(); Dialogue = ""; CurrentRoom = roomName; //moves Link to the bottom of the map to avoid issues where blocks would spawn on top of him //mygame.player.Position = new Vector2(6 * XSCALE + XOFFSET, 7 * YSCALE + YOFFSET); addWalls(); XElement roomFile = XElement.Load("../../../../Content/Rooms/" + roomName + ".xml"); if (roomFile.Descendants("Background").Count() > 0) { Console.WriteLine(roomFile.Descendants("Background").Count()); if (roomFile.Element("Asset").Element("Background").Value == "RoomBowBackground") { Background = BlockSpriteFactory.Instance.RoomBowBackground; } else if (roomFile.Element("Asset").Element("Background").Value == "BlackWithWallBackground") { Background = BlockSpriteFactory.Instance.BlackWithWallBackground; } } else { Background = floorBaseWithWalls; } IEnumerable <XElement> loadedEnvironmentObjects = from item in roomFile.Descendants("Item") where (string)item.Element("ObjectType") == "Environment" select item; foreach (XElement environmentObject in loadedEnvironmentObjects) { AddEnvironmentObject(environmentObject); } IEnumerable <XElement> loadedEnemies = from item in roomFile.Descendants("Item") where (string)item.Element("ObjectType") == "Enemy" select item; foreach (XElement enemyObject in loadedEnemies) { AddEnemy(enemyObject); Thread.Sleep(20); //used so the random number generator for enemies don't have the same seed. It's time based and without this they have the same seed. } IEnumerable <XElement> loadedItems = from item in roomFile.Descendants("Item") where (string)item.Element("ObjectType") == "Item" select item; foreach (XElement itemObject in loadedItems) { AddItem(itemObject, Items); } IEnumerable <XElement> loadedHiddenItems = from item in roomFile.Descendants("Item") where (string)item.Element("ObjectType") == "HiddenItem" select item; foreach (XElement itemObject in loadedHiddenItems) { AddItem(itemObject, HiddenItems); } IEnumerable <XElement> loadedNPCs = from item in roomFile.Descendants("Item") where (string)item.Element("ObjectType") == "NPC" select item; foreach (XElement NPCObject in loadedNPCs) { AddNPC(NPCObject); } IEnumerable <XElement> loadedDoors = from item in roomFile.Descendants("Door") select item; foreach (XElement DoorObject in loadedDoors) { AddDoor(DoorObject); } }