public void EnqueueCustomers(CustomerNpc npc) { if (!AtCapacity()) { int count = customersInQueue.Count; customersInQueue.Enqueue(npc); this.PositionCustomer(count, npc); } }
public static CustomerNpc GetCustomerNpcPrefab() { if (!PrefabValid) { prefab = AssetDatabase.LoadAssetAtPath <GameObject>(prefabPath); } CustomerNpc instantiatedCustomer = GameObject.Instantiate(prefab).GetOrAddComponent <CustomerNpc>(); return(instantiatedCustomer); }
private void SpawnCustomersAtQueueHead(string queueHead = "", params CustomerOrder[] orders) { bool validQueuePosition = CustomerQueueHeadManager.TryGetCustomerQueueHead(queueHead, out CustomerQueueHead head); if (validQueuePosition) { for (int i = 0; i < orders.Length; i++) { activeOrders.Enqueue(orders[i]); CustomerNpc customer = CustomerNpcSpawner.GetCustomerNpcPrefab(); customer.SetCustomerAppearence(orders[i].NpcId); head.EnqueueCustomers(customer); } } }
private IEnumerator MoveFromView(bool remain) { if (customersInQueue.CollectionIsNotNullOrEmpty()) { CustomerNpc handling = customersInQueue.Dequeue(); Vector3 right = handling.transform.right; handling.transform.DOMove(handling.transform.position + right * 4, 1); yield return(new WaitForSeconds(1)); if (!remain) { Destroy(handling.gameObject); } } else { yield return(null); } }
private void PositionCustomer(int positionIndex, CustomerNpc npc) { if (positionIndex > capacity) { //waitlist position } else { if (positionIndex <= 0) { npc.transform.position = transform.position; } else { Vector3 position = GetPosition(positionIndex); npc.transform.position = position; } } }
void SendToWaitList(CustomerNpc npc) { }