using System.Collections; using UnityEngine; /// <summary> /// Performs a awaiting action while the customer is waiting on the customer queue /// </summary> public class WaitInTheQueueUntilFirst : PrimitiveTask { // ================== TASK ROUTINE ACTION ================== public override IEnumerator ExecuteRoutine(HTNPlanner planner) { //Cast Customer customer = planner.Agent as Customer; //Checks if the cast failed if (customer == null) { Debug.LogError("Cast Failed!"); } //Gets the payment area component PaymentArea area = planner.WorldState.Get<PaymentArea>("PaymentArea"); //The payment area takes control of the agent while (!area.IsFirstInQueue(customer)) { yield return null; } } }