public void ReadXmlPrototype(XmlReader reader_parent) { ////Debug.Log("ReadXmlPrototype"); objectType = reader_parent.GetAttribute("objectType"); XmlReader reader = reader_parent.ReadSubtree(); while (reader.Read()) { switch (reader.Name) { case "Name": reader.Read(); Name = reader.ReadContentAsString(); break; case "TypeTag": reader.Read(); typeTags.Add(reader.ReadContentAsString()); break; case "Description": reader.Read(); Description = reader.ReadContentAsString(); break; case "MovementCost": reader.Read(); movementCost = reader.ReadContentAsFloat(); break; case "Width": reader.Read(); Width = reader.ReadContentAsInt(); break; case "Height": reader.Read(); Height = reader.ReadContentAsInt(); break; case "LinksToNeighbours": reader.Read(); linksToNeighbour = reader.ReadContentAsBoolean(); break; case "EnclosesRooms": reader.Read(); roomEnclosure = reader.ReadContentAsBoolean(); break; case "CanReplaceFurniture": replaceableFurniture.Add(reader.GetAttribute("typeTag").ToString()); break; case "DragType": reader.Read(); dragType = reader.ReadContentAsString(); break; case "BuildingJob": float jobTime = float.Parse(reader.GetAttribute("jobTime")); List <Inventory> invs = new List <Inventory>(); XmlReader invs_reader = reader.ReadSubtree(); while (invs_reader.Read()) { if (invs_reader.Name == "Inventory") { // Found an inventory requirement, so add it to the list! invs.Add(new Inventory( invs_reader.GetAttribute("objectType"), int.Parse(invs_reader.GetAttribute("amount")), 0)); } } Job j = new Job( null, objectType, FurnitureActions.JobComplete_FurnitureBuilding, jobTime, invs.ToArray(), Job.JobPriority.High); j.JobDescription = "job_build_" + objectType + "_desc"; World.current.SetFurnitureJobPrototype(j, this); break; case "Action": XmlReader subtree = reader.ReadSubtree(); eventActions.ReadXml(subtree); subtree.Close(); break; case "ContextMenuAction": contextMenuLuaActions.Add(new ContextMenuLuaAction { LuaFunction = reader.GetAttribute("FunctionName"), Text = reader.GetAttribute("Text"), RequiereCharacterSelected = bool.Parse(reader.GetAttribute("RequiereCharacterSelected")) }); break; case "IsEnterable": isEnterableAction = reader.GetAttribute("FunctionName"); break; case "GetSpriteName": getSpriteNameAction = reader.GetAttribute("FunctionName"); break; case "JobSpotOffset": jobSpotOffset = new Vector2( int.Parse(reader.GetAttribute("X")), int.Parse(reader.GetAttribute("Y"))); break; case "JobSpawnSpotOffset": jobSpawnSpotOffset = new Vector2( int.Parse(reader.GetAttribute("X")), int.Parse(reader.GetAttribute("Y"))); break; case "Power": reader.Read(); powerValue = reader.ReadContentAsFloat(); break; case "Params": ReadXmlParams(reader); // Read in the Param tag break; case "LocalizationCode": reader.Read(); localizationCode = reader.ReadContentAsString(); break; case "UnlocalizedDescription": reader.Read(); unlocalizedDescription = reader.ReadContentAsString(); break; } } }