private void SpawnCustomer(CustomerServingArea servingArea) { if (servingArea.ServingAreaOccupied) { return; } Transform spawnEntranceRef = servingArea.GetComponent <ServeAreaPositions>().CustomerEntrance; Customer spawnedCustomer = Instantiate(customerPrefab, spawnEntranceRef.position, spawnEntranceRef.rotation, transform.parent); spawnedCustomer.StartCustomerCoroutine(servingArea, logicHandler); spawnedCustomer.OnCustomerLeaving.AddListener(OnCustomerLeaving); activeCustomers.Add(spawnedCustomer); GiveUIToCustomer(spawnedCustomer); }
/// <summary> /// Coroutine used for the customer's entry /// </summary> /// <returns></returns> IEnumerator CustomerEntry() { yield return(MoveToPosition(servingArea.GetComponent <ServeAreaPositions>().CustomerServeAreaPosition.position)); }