public IEnumerator RestockShelf(GameObject type, float time) { if (plate != null) { for (int i = 0; i < plateMarkers.Count; i++) { GameObject p = Instantiate(plate, plateMarkers[i].transform.position, Quaternion.identity); Move_S surface = p.GetComponentInChildren <Move_S>(); surface.SetMarker(plateMarkers[i]); plateMarkers[i].SetOccupation(true); plates.Add(surface); p.transform.SetParent(transform); yield return(new WaitForSeconds(time)); } } }
public void SpwanObject() //function to spawn an object is required { if (surface != null) { GameObject obj = Instantiate(surface, transform.position, Quaternion.identity); Move_S s = obj.GetComponentInChildren <Move_S>(); if (s != null) { s.SetMarker(this); } SetOccupation(true); if (surface.CompareTag("Plate")) { PlateStock plateStock = GetComponentInParent <PlateStock>(); plateStock.PlateList().Add(s); obj.transform.SetParent(transform.parent); } } }