void CheckPlateCount() //checking if plates need to be restocked
    {
        PlateStock parent = GetComponentInParent <PlateStock>();

        if (parent != null)
        {
            if (parent.PlateList().Contains(this))
            {
                parent.PlateList().Remove(this);
            }

            if (parent.PlateList().Count == 0)
            {
                StartCoroutine(parent.RestockShelf(parent.plate, .2f));
            }
        }
    }
Esempio n. 2
0
 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);
         }
     }
 }