public void RemoveItem(TechType techType, EatableType eatableType) { var pickupable = techType.ToPickupable(); if (Inventory.main.HasRoomFor(pickupable)) { EatableEntities match = FindMatch(techType, eatableType); if (match != null) { var go = GameObject.Instantiate(CraftData.GetPrefabForTechType(techType)); var eatable = go.GetComponent <Eatable>(); var pickup = go.GetComponent <Pickupable>(); match.UnpauseDecay(); eatable.timeDecayStart = match.TimeDecayStart; if (Inventory.main.Pickup(pickup)) { QuickLogger.Debug($"Removed Match Before || Fridge Count {FridgeItems.Count}"); FridgeItems.Remove(match); QuickLogger.Debug($"Removed Match || Fridge Count {FridgeItems.Count}"); } else { QuickLogger.Message(LanguageHelpers.GetLanguage("InventoryFull"), true); } GameObject.Destroy(pickupable); OnContainerUpdate?.Invoke(NumberOfItems, _itemLimit); } } }
public Pickupable RemoveItemFromContainer(TechType techType, int amount) { EatableEntities match = FindMatch(techType, EatableType.Any); if (match == null) { return(null); } var go = GameObject.Instantiate(CraftData.GetPrefabForTechType(techType)); var eatable = go.GetComponent <Eatable>(); var pickup = go.GetComponent <Pickupable>(); match.UnpauseDecay(); eatable.timeDecayStart = match.TimeDecayStart; FridgeItems.Remove(match); OnContainerUpdate?.Invoke(NumberOfItems, _itemLimit); return(pickup); }