public List <BioEnergy> GetMaterialsInProcessing() { var list = new List <BioEnergy>(); for (int m = 0; m < _materials.Values.Count; m++) { EmModuleSaveData savedItem = _materials.Values[m]; var techTypeID = (TechType)savedItem.ItemID; var gameObject = GameObject.Instantiate(CraftData.GetPrefabForTechType(techTypeID)); Pickupable pickupable = gameObject.GetComponent <Pickupable>().Pickup(false); list.Add(new BioEnergy(pickupable, savedItem.RemainingCharge)); } return(list); }
public List <BioEnergy> GetMaterialsInProcessing() { var list = new List <BioEnergy>(); for (int m = 0; m < _materials.Values.Count; m++) { EmModuleSaveData savedItem = _materials.Values[m]; if (savedItem.ItemID <= 0) { continue; } GameObject prefab = CraftData.GetPrefabForTechType((TechType)savedItem.ItemID); if (prefab == null) { continue; } var gameObject = GameObject.Instantiate(prefab); if (gameObject == null) { continue; } Pickupable pickupable = gameObject.GetComponent <Pickupable>(); if (pickupable == null) { continue; } pickupable.Pickup(false); list.Add(new BioEnergy(pickupable, savedItem.RemainingCharge)); } return(list); }