// Update is called once per frame void Update() { if (!done_initial_setup) { movement = GetComponent <NPCDefault> (); interaction = GetComponentInChildren <NPCInteraction> (); // Choose which line to queue for. GameObject[] targets = GameObject.FindGameObjectsWithTag("QueueTarget"); queue_target = targets [Random.Range(0, targets.Length)]; queue = queue_target.GetComponent <QueueManager> (); queue.Add(gameObject); in_queue = true; done_initial_setup = true; } if (in_queue) { if (queue.Contains(gameObject)) { movement.override_destination = true; movement.destination = queue.GetPosition(gameObject); } else { LeaveQueue(); } } if (GameManagerScript.moment != GameManagerScript.DAY) { LeaveQueue(); } }