public virtual void PlaceInWorld(FurnitureManager fm) { if (fm == null) { return; } bool worked = fm.PlaceFurniture(Prefab, X, Y); if (!worked) { Debug.LogError("Failed to place '" + Prefab + "'! Data may be lost!"); } else { Furniture f = fm.GetFurnitureAt(X, Y); if (f != null) { ApplyData(f); } else { Debug.LogError("Placed furniture '" + Prefab + "' at " + X + ", " + Y + " but requesting the placed object failed! Might result in data loss for placed furniture."); } } }
private void ReadXml_Furnitures(XmlReader reader) { if (reader.ReadToDescendant("Furniture")) { do { int x = int.Parse(reader.GetAttribute("X")); int y = int.Parse(reader.GetAttribute("Y")); int z = int.Parse(reader.GetAttribute("Z")); float rotation = float.Parse(reader.GetAttribute("Rotation")); Furniture furniture = FurnitureManager.PlaceFurniture(reader.GetAttribute("type"), tiles[x, y, z], false, rotation); furniture.ReadXml(reader); }while (reader.ReadToNextSibling("Furniture")); } }