public System.Collections.IEnumerator Interacting() { while (true) { yield return(new WaitForSeconds(waitTime)); ItemStack drop = lootTable.GetDrop(); if (drop.GetItem().itemData == itemMain) { int dropAmount = Mathf.Min(resourceAmount, drop.GetAmount()); resourceAmount -= dropAmount; breaker.AddItem(new ItemStack(itemMain, dropAmount)); if (resourceAmount == 0) { tile.SetTileData(TileData.AIR); } } else { breaker.AddItem(drop); } } }