public bool CheckOrders(Customer.Menu dish) { float min = 18; int index = -1; int indexCustomer = -1; for (int i = 0; i < customers.Count; i++) { if (customers[i] != null) { var order = customers[i].GetComponent <Customer>().Order; float waitTime = customers[i].transform.GetChild(0).transform.GetChild(1).GetComponent <UnityEngine.UI.Image>().fillAmount * 18; for (int j = 0; j < order.Length; j++) { if (dish == order[j] && waitTime < min) { min = waitTime; index = j; indexCustomer = i; } } } } if (min < 18) { customers[indexCustomer].GetComponent <Customer>().DestroyDish(index); return(true); } return(false); }
public bool GiveDish(Customer.Menu dish) { //Debug.LogError(GetComponentInParent<ControllerControllers>().CustomersController == null); return(transform.parent.transform.GetChild(1).GetComponent <CustomersController>().CheckOrders(dish)); }