//Coroutine to spread the infection IEnumerator InfectionSpread(){ //loops untill all are infected for (int InfectedCount = 1; InfectedCount <= 34; InfectedCount ++){ //whats used untill 5 passengers are infected if(InfectedCount <= 5){ //decreases the time it takes for someone to be infected as more people become infected yield return new WaitForSeconds((60f/InfectedCount) + (1.2f*InfectedCount)); //chooses from a range of passengers close to patient zero (or last passenger infected) int min = PatientZero - 7; if (min < 0) min = 0; int max = PatientZero + 7; if (max > 34)max = 34; int newInfected = rand.Next(min,max); CheckInfection ci = new CheckInfection(); //change the newly infected persons symptoms ci = (CheckInfection)PassengerArray[newInfected].GetComponent("CheckInfection"); ci.isInfected = true; ci.nausea = true; ci.fever = true; ci.cough = true; ci.sneeze = true; ci.highBP = true; ci.rash = true; ci.temperature = rand.NextDouble() * (102.50 - 100.00) + 100.00; ci.diastolicBP = rand.Next (81, 100); ci.systolicBP = rand.Next (125, 160); //SOMETHING TO MAKE RASH APPEAR //assigns a new speak for the infected int dia = rand.Next (1,5); if (dia == 1) ci.speak = "Oh this, I think its just a cold"; if (dia == 2) ci.speak = "*cough cough* mmmgghmmm, sorry. I picked up a cough earlier today"; if (dia == 3) ci.speak = "...ugh. I think this flight is gettin to me"; if (dia == 4) ci.speak = "I think the altitude's getting to me. My head is killing me"; if (dia == 5) ci.speak = "I don't know what it is, kust started feeling bad today"; //sets new patient zero to start over PatientZero = newInfected; } else{ //after 5 or more are infected, but more or less the same yield return new WaitForSeconds(15f); int min = PatientZero - 7; if (min < 0) min = 0; int max = PatientZero + 7; if (max > 34)max = 34; int newInfected = rand.Next(min,max); CheckInfection ci = new CheckInfection(); ci.isInfected = true; ci.nausea = true; ci.fever = true; ci.cough = true; ci.sneeze = true; ci.highBP = true; ci.rash = true; ci.temperature = rand.NextDouble() * (102.50 - 100.00) + 100.00; ci.diastolicBP = rand.Next (81, 100); ci.systolicBP = rand.Next (125, 160); //SOMETHING TO MAKE THE RASH APPEAR int dia = rand.Next (1,5); if (dia == 1) ci.speak = "Oh this, I think its just a cold"; if (dia == 2) ci.speak = "*cough cough* mmmgghmmm, sorry. I picked up a cough earlier today"; if (dia == 3) ci.speak = "...ugh. I think this flight is gettin to me"; if (dia == 4) ci.speak = "I think the altitude's getting to me. My head is killing me"; if (dia == 5) ci.speak = "I don't know what it is, kust started feeling bad today"; PatientZero = newInfected; } } }
void Start () { //fill array with the passengers of different tags for(int i = 1; i <= 35; i++){ PassengerArray[i-1] = GameObject.FindGameObjectWithTag("Pass"+i); } //infects first person CheckInfection ciF = new CheckInfection(); ciF = (CheckInfection)PassengerArray[PatientZero].GetComponent("CheckInfection"); ciF.isInfected = true; ciF.nausea = true; ciF.fever = true; ciF.cough = true; ciF.sneeze = true; ciF.highBP = true; ciF.rash = true; ciF.temperature = rand.NextDouble() * (102.50 - 100.00) + 100.00; ciF.diastolicBP = rand.Next (81, 100); ciF.systolicBP = rand.Next (125, 160); //SOMETHING TO MAKE RASH APPEAR int diaF = rand.Next (1,5); if (diaF == 1) ciF.speak = "Oh this, I think its just a cold"; if (diaF == 2) ciF.speak = "*cough cough* mmmgghmmm, sorry. I picked up a cough earlier today"; if (diaF == 3) ciF.speak = "...ugh. I think this flight is gettin to me"; if (diaF == 4) ciF.speak = "I think the altitude's getting to me. My head is killing me"; if (diaF == 5) ciF.speak = "I don't know what it is, kust started feeling bad today"; //begin the spread!!! StartCoroutine (InfectionSpread()); }
//the actual inspection method void Inspection(){ //Raycasts on left click to try and find a passenger prefab if(Input.GetMouseButtonDown (0)){ RaycastHit hit = new RaycastHit(); Ray ray = new Ray(); ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000f) && Input.GetMouseButtonDown(0)){ //casts tag to string in order to confirm the correct prefab was selecteed string check = (string)hit.collider.gameObject.tag; //checks if(check.Contains(checkForPass)){ //sets curPass as selected object curPass = hit.collider.gameObject; //casts object to a CheckInfection ci = (CheckInfection)curPass.GetComponent("CheckInfection"); } } //Sets the return spot for the camera when done with inspection cameraReturn = Camera.main.transform.position; //BELOW SCRIPTS NOT COMPLETE. THESE WILL MOVE THE CAMERA TO THE CORRECT SPOT FOR INSPECTION /*however much to move the camera away from the passenger*/ Vector3 moveCamera = curPass.transform.position + camera.transform.position; transform.position = Vector3.Lerp(transform.position, moveCamera/*wherever we're sending the camera*/, /*value to "smooth the transition*/ 20* Time.deltaTime); //We Need to be able to click on a passenger only if the cursor is on a GameOBject //ABOVE SCRIPTS NOT COMPLETE. THESE WILL MOVE THE CAMERA TO THE CORRECT SPOT FOR INSPECTION //***Display ci.speak wherever it needs to be*** } //Backs out from a selection if(Input.GetMouseButtonDown (1)){ //returns camera to spot before inspection Camera.main.transform.Translate(cameraReturn); //resets ci to a blank new CheckInfection ci = new CheckInfection(); } //What happens when you click an object durring an inspection if(Input.GetMouseButtonDown (0)){ //checks to make sure ci has been initialized if(ci.temperature != null){ RaycastHit hit = new RaycastHit(); Ray ray = new Ray(); ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000f) && Input.GetMouseButtonDown(0)){ //checks to make sure a "checkable" object has been selected string check = (string)hit.collider.gameObject.tag; if(check.Contains(checkForCheck)){ //casts curBodyPart to selected object curBodyPart = hit.collider.gameObject; } } } } //fever check if(curBodyPart.tag == /*tag of fever check collider */ "feverCheck"){ //perform animation for check //ANIMATION GOES HERE //adds temperature to the displayed information ci.speak+=("\nTemperature (in Fahrenheit): " + ci.temperature); } //blood pressure check if(curBodyPart.tag == /*tag of BP check collider */ "BPCheck"){ //perform animation for check //ANIMATION GOES HERE //adds blood pressure to available information ci.speak+=("\nBlood Pressure: " + ci.systolicBP + " / "+ ci.diastolicBP); } }