public void CreateItemsBasedOnTick() { if (isFirstRun) { isFirstRun = false; StopAllCoroutines(); } if (curTick >= tickCount) { for (int i = 0; i < allBeltItemSlotsArray.Length; i++) { BeltItemSlot slot = allBeltItemSlotsArray[i]; if (slot != null) { if (slot.myItem == null) { BeltMaster.CreateItemAtBeltSlot(Instantiate(itemPrefab).GetComponent <BeltItem>(), slot); } } } curTick = 0; } curTick++; }
public void CreateItemsBasedOnTick() { if (curTick >= tickCount) { foreach (BeltItemSlot slot in myBeltItemSlots) { if (slot != null) { BeltMaster.CreateItemAtBeltSlot(Instantiate(itemPrefab).GetComponent <BeltItem>(), slot); } } curTick = 0; } curTick++; }
// Update is called once per frame IEnumerator CreateItems() { yield return(new WaitForSeconds(1f)); while (true) { if (isActive) { foreach (BeltItemSlot slot in myBeltItemSlots) { if (slot != null) { BeltMaster.CreateItemAtBeltSlot(Instantiate(itemPrefab).GetComponent <BeltItem>(), slot); } } } yield return(new WaitForSeconds(delay)); } }
// Update is called once per frame IEnumerator CreateItems() { yield return(new WaitForSeconds(1f)); while (true) { if (isActive) { for (int i = 0; i < allBeltItemSlotsArray.Length; i++) { BeltItemSlot slot = allBeltItemSlotsArray[i]; if (slot != null) { if (slot.myItem == null) { BeltMaster.CreateItemAtBeltSlot(Instantiate(itemPrefab).GetComponent <BeltItem>(), slot); } } } } yield return(new WaitForSeconds(delay)); } }