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++; }
// Start is called before the first frame update void Start() { s = this; if (autoStart) { Invoke("LateStart", 5f); } }
public void DestroyItemsOnSlots() { foreach (BeltItemSlot slot in allBeltItemSlots) { if (slot != null) { BeltMaster.DestroyItem(slot.myItem); } } }
// Start is called before the first frame update void Start() { s = this; if (autoStart) { print("Starting Belt System"); SetupBeltSystem(); StartBeltSystemLoops(); } }
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)); } }