public void SetQueueDestination(CustomerController caller) { foreach (Transform node in transform) { CustomerNode customerNode = null; if (node.TryGetComponent(out customerNode)) { bool target = customerNode.GetOccupant() == caller.gameObject; if (target) { return; } } customerNode.Queue(caller); } }
public Transform GetHighestAvailableNode(CustomerController caller) { Transform lastNode = null; foreach (Transform node in transform) { CustomerNode customerNode = null; if (node.TryGetComponent(out customerNode)) { bool occupied = customerNode.IsOccupied(); if (!occupied) { return(node); } } customerNode.Queue(caller); lastNode = node; } //if there are no more nodes available in the paying line, the last one will be returned return(lastNode); }