private IEnumerator C_Burn() { while (true) { yield return(m_UpdateInterval); // If the fuel, or the items to burn finished, stop burning. if (!FuelSlot.CurrentItem || !InputSlot.CurrentItem) { StopBurning(); yield break; } var burnTime = m_BurnTimeProperty.Float; burnTime.Current -= UPDATE_INTERVAL; m_BurnTimeProperty.SetValue(ItemProperty.Type.Float, burnTime); Progress.Set(1f - burnTime.Ratio); if (burnTime.Current <= 0f) { ItemData resultedItem; if (GameController.ItemDatabase.FindItemByName(m_ItemResult, out resultedItem)) { CollectionUtils.AddItem(resultedItem, 1, LootSlots); } else { Debug.LogWarning("The item has burned but no result was given, make sure the item has the 'Burn Result' property, so we know what to add as a result of burning / smelting.", this); } if (InputSlot.CurrentItem.CurrentInStack == 1) { InputSlot.SetItem(null); StopBurning(); yield break; } else { burnTime.Current = burnTime.Default; m_BurnTimeProperty.SetValue(ItemProperty.Type.Float, burnTime); InputSlot.CurrentItem.CurrentInStack--; } } var fuelTime = m_FuelTimeProperty.Float; fuelTime.Current -= UPDATE_INTERVAL; m_FuelTimeProperty.SetValue(ItemProperty.Type.Float, fuelTime); if (fuelTime.Current <= 0f) { if (FuelSlot.CurrentItem.CurrentInStack == 1) { FuelSlot.SetItem(null); StopBurning(); yield break; } else { fuelTime.Current = fuelTime.Default; m_FuelTimeProperty.SetValue(ItemProperty.Type.Float, fuelTime); FuelSlot.CurrentItem.CurrentInStack--; } } } }