//create a new customer and assign it to a CustomerStand IEnumerator AssignCustomer(CustomerStand customerStand, int minDelay = 1) { yield return(new WaitForSeconds(new System.Random().Next(minDelay, minDelay + 10))); if (!isGameOver) { Debug.Log("Parent pos: " + (transform.position)); Customer customer = Instantiate(customerPrefab); customer.name = customerStand.name; customer.transform.position = Camera.main.WorldToScreenPoint(customerStand.transform.position) - transform.position + offset; customer.transform.SetParent(transform, false); customer.GotoCustomerStand(customerStand); customerStand.CustomerArrived(customer); customer.RegisterGameOver(gameOverController); totalCustomerCount++; } }
//set customer statnd to customer and wait for order public void GotoCustomerStand(CustomerStand stand) { Stand = stand; waitingTimeCoroutine = StartCoroutine(WaitingTmeCounter()); }