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) { if (_timeLeft - KDayInSeconds >= 0) { return(techType.ToPickupable()); } return(null); }
public static bool GivePlayerItem(TechType techType, int amount = 1) { try { for (int i = 0; i < amount; i++) { if (!Inventory.main.Pickup(techType.ToPickupable())) { QuickLogger.Message(LanguageHelpers.GetLanguage("InventoryFull"), true); return(false); } } } catch (Exception e) { QuickLogger.Error <FCSDeepDrillerContainer>(e.Message); QuickLogger.Error <FCSDeepDrillerContainer>(e.StackTrace); return(false); } return(true); }