public void DelayedPersonMove(float time, Vector2 m, string dName, bool pObject = true, OfficeObject officeobject = null) { //set the value of each variable. delayedMoveM = m; delayedDName = dName; delayedPObject = pObject; delayedOfficeobject = officeobject; //Perform the Delay. StartCoroutine("DelayedMovement", time); }
public override void VisitStart(OfficeWorld world) { base.VisitStart(world); this.levelData = Serializer.Deserialize(this.pathLevel); // Create Objects OfficeObject office = new OfficeObject(); PatientObject patient = new PatientObject(); patient.Alias = "main"; ToubibObject toubib = new ToubibObject(); toubib.Alias = "main"; NotebookObject notebook = new NotebookObject(); notebook.Alias = "main"; BubbleObject bubble = new BubbleObject(); bubble.Alias = "main"; TimerObject timer = new TimerObject(); timer.Alias = "main"; QueueTalkObject queueTalk = new QueueTalkObject(); queueTalk.Alias = "main"; QueueDreamObject queueDream = new QueueDreamObject(); queueDream.Alias = "main"; //TestObject test = new TestObject(); DialogueObject dialoguePatient = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientDialogue); dialoguePatient.Alias = "patient"; DialogueObject dialogueToubib = DialogueFactory.CreateDialogueFactory(60, this.levelData.ToubibDialogue); dialogueToubib.Alias = "toubib"; DialogueObject dialogueAnswer = DialogueFactory.CreateDialogueFactory(30, this.levelData.AnswerTokens); dialogueAnswer.Alias = "answer"; DialogueObject dialogueSuccessAnswer = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientSuccessAnswer, TokenType.NORMAL); dialogueSuccessAnswer.Alias = "successAnswer"; DialogueObject dialogueFailAnswer = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientFailAnswer, TokenType.NORMAL); dialogueFailAnswer.Alias = "failAnswer"; DialogueObject dialogueComing = DialogueFactory.CreateDialogueFactory(30, "Hum, Entrez ...", TokenType.NORMAL); dialogueComing.Alias = "coming"; AToken timerToken = DialogueFactory.CreateToken(string.Empty, TokenType.TIMER); timerToken.Alias = "main"; // Create layers Layer background = new Layer(); Layer middleground = new Layer(); Layer foreground = new Layer(); Layer textLayer = new Layer(); Layer answerLayer = new Layer(); // Add Resources List <string> resourcesToLoad = new List <string>(); resourcesToLoad.Add(this.LevelName); resourcesToLoad.Add(office.Id); resourcesToLoad.Add(toubib.Id); resourcesToLoad.Add(patient.Id); resourcesToLoad.Add(notebook.Id); resourcesToLoad.Add(bubble.Id); resourcesToLoad.Add(queueTalk.Id); resourcesToLoad.Add(queueDream.Id); resourcesToLoad.Add(timer.Id); resourcesToLoad.Add("normalToken"); resourcesToLoad.Add("sanctuaryToken"); resourcesToLoad.Add("answerToken"); resourcesToLoad.Add("lampClipped"); resourcesToLoad.Add("wordPicked"); resourcesToLoad.Add("bubbleClosed"); resourcesToLoad.Add("bubbleOpened"); resourcesToLoad.Add("wordInserted"); resourcesToLoad.Add("wordDroped"); resourcesToLoad.Add("dialoguePatient"); resourcesToLoad.Add("dialogueToubib"); resourcesToLoad.Add("dialogueReflexion"); resourcesToLoad.Add("dialoguePatientSuccess"); resourcesToLoad.Add("dialoguePatientFail"); resourcesToLoad.Add("doorKnock"); resourcesToLoad.Add("endTimer"); resourcesToLoad.Add("validationSuccess"); resourcesToLoad.Add("validationFail"); /*resourcesToLoad.Add(patient.Id); * resourcesToLoad.Add(toubib.Id);*/ world.NotifyResourcesToLoad(resourcesToLoad); // Add Layers world.AddLayer(background); world.AddLayer(middleground); world.AddLayer(foreground); world.AddLayer(textLayer); world.AddLayer(answerLayer); // Add Objects /*world.AddObject(test, 0); * world.AddObject(patient, 0); * world.AddObject(toubib, 0);*/ world.AddObject(office, 0); world.AddObject(toubib, 1); world.AddObject(patient, 1); world.AddObject(queueTalk, 2); world.AddObject(queueDream, 2); world.AddObject(timer, 2); world.AddObject(timerToken, 3); world.AddObject(notebook, 2); world.AddObject(bubble, 2); world.AddObject(dialoguePatient, 3); world.AddObject(dialogueToubib, 3); world.AddObject(dialogueAnswer, 4); world.AddObject(dialogueFailAnswer, 3); world.AddObject(dialogueSuccessAnswer, 3); world.AddObject(dialogueComing, 3); // Set Object Position. office.SetKinematicParameters(new Vector2f(0, 0), new Vector2f(0, 0)); toubib.SetKinematicParameters(new Vector2f(150, 160), new Vector2f(0, 0)); patient.SetKinematicParameters(new Vector2f(-550, 140), new Vector2f(0, 0)); notebook.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); bubble.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); queueTalk.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); queueDream.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); timer.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); timerToken.SetKinematicParameters(new Vector2f(400, 260), new Vector2f(0f, 0f)); queueTalk.SetAnimationIndex(1); queueDream.SetAnimationIndex(1); }
/// <summary> /// Move to specified location. Called by Hotspot or Manager /// </summary> /// <param name="m">Location to move to</param> /// <param name="dName">Tag of destination</param> /// <param name="pObject">Is this a Patient Object?</param> /// <param name="officeobject">The class</param> public void PersonMove(Vector2 m, string dName, bool pObject = true, OfficeObject officeobject = null) { //if I am a nurse, set myself to busy if (gameObject.CompareTag("Nurse")) { (this as Nurse).IsBusy(-1); if (Vector2.Distance(m, transform.position) > Mathf.Abs(0.1f)) { (this as Nurse).NurseAnimation("Walk", true, false); } } else if (gameObject.CompareTag("Patient")) { //Debug.Log("Setting Patient Walking to True"); (this as Patient).PatientAnimation("Highlight", false, false); (this as Patient).PatientAnimation("Walking", false, true); } //make sure that I have a reference to my polynav agent. if (agent == null) { agent = GetComponent<PolyNavAgent>(); } destinationName = dName; //Debug.Log("OfficeObject = " + officeobject); if (officeobject) { patientObject = pObject; officeObject = officeobject; } //make sure that the agent is enabled, and then set the agent's destination. agent.enabled = true; moving = true; agent.SetDestination(m, PersonMovementStatus); }
/// <summary> /// Called after a movement action has been taken /// </summary> /// <param name="moved">True - Reached Destination | False - Did not reach Destination</param> private void PersonMovementStatus(bool moved) { Debug.Log(name + " has arrived at destination " + destinationName); //inform self that my status has changed, so if I'm a nurse, I should now be either waiting at triage, waiting at waiting room, or waiting in patient room if (moved && gameObject.CompareTag("Patient")) { Patient p = (this as Patient); p.PatientStatusUpdate(destinationName); if (p.PatientHotspotGet()) { //p.PatientHotspotGet().OfficeObjectSetReadyState(true); } if (p.Status() == "ExamRoom") { manager.MyNurse.NurseExamRoomArrival(p, officeObject); } } else if (gameObject.CompareTag("Nurse")) { string status = " "; //if we are dealing with a patientobject if (patientObject) { status = (officeObject as PatientObject).MyPatient.Status(); if (destinationName == "WaitingChair") { //Turn to the right (this as Nurse).NurseAnimation("FaceRight",true,false); Debug.Log("Turning to the right"); //Check for clean hands. MyManager.CleanHandsCheck(); //open the UI of the Waiting Chair (officeObject as PatientObject).PatientObjectOpenUI(); //Debug.Log("Opened the UI for " + officeObject.name); } else if (destinationName == "ExamRoom") { //if the patient is currently waiting to get their vitals checked. if (status == "Vitals") { //the patient is waiting for their vitals to be checked. //perform vital sign check, another conversation between nurse and patient, and then popup. (this as Nurse).NursePerformAction("Vitals", officeObject, (officeObject as PatientObject).MyPatient); } //if the patient is currently waiting to get a diagnosis else if (status == "Diagnosis") { //the patient is waiting to be diagnosed. //RON COME BACK AND CHANGE THIS //do nothing.. or move to the computer } //else if (status == "ExamRoom") //{ //Moved down below //} } } else { Debug.Log("DestinationName : " + destinationName); if (destinationName == "ExamRoomComputer") { //Make sure that the nurse faces the computer. (this as Nurse).NurseAnimation("FaceBack", true, false); //get the patient //Debug.Log("OfficeObject = " + officeObject); Patient p = (officeObject as ExamRoomComputer).MyExamRoom().MyPatient; //Debug.Log("The patient the nurse is seeing is: " + p + " and their status is " + p.Status()); //If the status is exam room or waiting chair, the patient is on their way and the nurse must setup and prepare the computer. if (p.Status() == "ExamRoom" || p.Status() == "WaitingChair") { //same /similar process as vitals //(this as Nurse).NursePerformAction("ExamRoomSetup", officeObject, p); //Debug.Log("Nurse setting up arrival"); (this as Nurse).NurseExamRoomArrival(this, officeObject); } else { //Check for clean hands. MyManager.CleanHandsCheck(); //Open up the Interface for the computer. manager.GamePlayUI().ExamRoomComputerUI().SetPatient((officeObject as ExamRoomComputer).MyExamRoom().MyPatient); manager.GamePlayUI().ExamRoomComputerUI().gameObject.SetActive(true); } //open up the examroom computer with the proper information //The method should take in the patient, and open up the interface based on the patient's status. //if the status of the patient is VitalsComplete, display 100% of information and pose the question to get bloodwork. //if the status of the patient is vitals, display only the story, name and dob. //if the status of the patient is bloodwork, display 100% of the information. //if the status of the patient is diagnosis, display the abg tool } else if (destinationName == "Sink") { (this as Nurse).NursePerformAction("Wash Hands",officeObject); } else if (destinationName == "ReferenceDesk") { //Make sure that the nurse is facing the reference desk (this as Nurse).NurseAnimation("FaceFront", true, false); //open up the reference desk (officeObject as ReferenceDesk).OpenReferenceDesk(); //pause the game? } } patientObject = false; officeObject = null; agent.enabled = false; (this as Nurse).IsBusy(1); } moving = false; }