void SpawnObject() { timer = 0; waitTime = Random.Range(timeBetweenObjectsSpawned.min, timeBetweenObjectsSpawned.max); GameObject coObject = SpawnFromPool(prefab.name, points[0].position, Quaternion.identity); ConveyorObjects co = coObject.GetComponent <ConveyorObjects>(); co.Init(this); }
public void SetTarget(ConveyorObjects cart) { int index = cart.pointIndex; index++; if (index < points.Length) { cart.targetPoint = points[index]; cart.pointIndex = index; } else { cart.gameObject.SetActive(false); } }