private static PropSdo ConvertPropForSaving(Prop prop) { if (prop == null) { return(null); } var propType = prop.GetType(); PropSdo sdo = null; if (propType == typeof(CheeseTree)) { sdo = new CheeseTreeSdo(); } else if (propType == typeof(Chest)) { sdo = new ChestSdo((Chest)prop); } else if (propType == typeof(Field)) { sdo = new FieldSdo((Field)prop); } else if (propType == typeof(Grave)) { sdo = new GraveSdo((Grave)prop); } else if (propType == typeof(Furniture)) { sdo = new FurnitureSdo((Furniture)prop); } return(sdo); }
public Chest(ChestSdo sdo) : base("0", BuildingPrefabStore.GetChestPrefab(), true) { _contents = new Dictionary <Guid, Item>(); foreach (var itemId in sdo.ContentIds) { var item = WorldData.Instance.Items[itemId]; _contents.Add(item.Id, item); } }