public bool BehaviorCompleted(float deltaTime) { // update door if (doorOpening && door != null) { if (iTween.Count(door) == 0) { CloseDoor(!doubleDoor); doorOpening = false; } } if (currentTask == "visit") { if (person.HasArrivedStop(0.1f, currentNode.position2)) { currentBehaviour++; return(true); } } else if (currentTask == "visitQueue") { if (person.HasArrivedStop(0.1f, currentNode.position2)) { // if have reached final destination (ready for help) return(true); } } else if (currentTask == "enteringQueue") { if (person.HasArrivedStop(0.1f, finalPosition)) { if (p_service.FirstInLine(person)) { p_service.ReadyForService(person); } return(true); } } else if (currentTask == "door") { if (person.HasArrivedStop(0.5f)) { OpenDoor(); Wait(30); currentTask = "doorWait"; } } else if (currentTask == "doorWait") { if (TimeController.WaitForSeconds(this.GetID())) { person.VisitPosition(currentNode.position3); currentTask = "visit"; } } else if (currentTask == "wait") { if (TimeController.WaitForSeconds(this.GetID())) { OpenDoor(); currentNode.available = true; currentBehaviour++; return(true); } } else if (currentTask == "wait infinite") { // wait forever } else if (currentTask == "exit") { if (person.HasArrivedStop()) { currentBehaviour++; return(true); } // ------------------ FOR EMPLOYEE ------------------ } else if (currentTask == "work") { if (p_service.ReadyForService(person)) { // can help passenger Employee employee = (Employee)person; //Debug.Log("ready for service"); if (employee.HelpPassenger(p_service.GetPassenger(), deltaTime)) { // helping is complete, notify passengerService p_service.AssistPassengerComplete(); } } } else if (currentTask == "queue") { } else { Debug.Log("don't know if this behaviour is complete: " + currentTask); } return(false); }