public void RemoveCatalog(BaseCatalog catalog) { if (catalogs.Contains(catalog)) { catalogs.Remove(catalog); } }
public void AddNewCatalog(BaseCatalog nCatalog) { if (catalogs.Contains(nCatalog)) { Debug.LogError("El objeto ya existe"); } else { catalogs.Add(nCatalog); } if (!CatalogsByKey.ContainsKey(nCatalog.name)) { CatalogsByKey.Add(nCatalog.name, nCatalog); } }
public Dictionary <string, List <BaseProduct> > GetItemsPerClassFromCatalog(BaseCatalog catalog) { RemoveNullEmpty(catalogs); catalogs.Sort(ScriptableObjectComparer); Dictionary <string, List <BaseProduct> > products = new Dictionary <string, List <BaseProduct> >(); foreach (BaseProduct baseProduct in catalog.Products) { string key = baseProduct.Item.GetType().FullName; if (!products.ContainsKey(key)) { products.Add(key, new List <BaseProduct>()); } products[key].Add(baseProduct); } return(products); }