private void getNumPolice(GameObject pl) { foreach (var el in PoliceLines) { PoliceLineController plScript = (PoliceLineController)el.GetComponent("PoliceLineController"); policeTotal += plScript.getNumPolice(); Debug.Log("New Police Total:" + policeTotal); } }
// Start is called before the first frame update void Start() { transitGenerator = gameObject.GetComponent <TransitStopGenerator>(); plcontroller = PoliceLinetemplate.GetComponent <PoliceLineController>(); List <GameObject> l = transitGenerator.GenerateStops(); foreach (GameObject stop in l) { BusStops.Add(stop); stopstot++; } /*Scenario 1 */ /*for(int i=0;i<10;i++){ * StartCoroutine(delaySpawnCrowdAroundSpot(new Vector3((float)(-66+i*5),29f,(float)(50-5*i)), 100,15,3)); * * }*/ /* Quaternion rot = new Quaternion (0.0f,-0.4f,0.0f,0.9f); * Queue<Vector3> waypoints = new Queue<Vector3>(); * Queue<float> delays = new Queue<float>(); * //delays.Enqueue(10f); //For Vancouver Conference Run * waypoints.Enqueue(new Vector3(-66.6f, 31.5f, 47.6f)); * //96.25958-15.32647 = 81 * delays.Enqueue(22+2f); * waypoints.Enqueue(new Vector3(-97.0f, 31.1f, 78.9f)); * //153.9031-106.9043 = 47 * delays.Enqueue(13+2f); * waypoints.Enqueue(new Vector3(-130.1f, 32.6f, 112.7f)); * //210.5616-161.3619 = 50 * delays.Enqueue(13+2f); * waypoints.Enqueue(new Vector3(-155.5f, 33.0f, 130.3f)); * //252.7543-214.8141 = 38 * delays.Enqueue(10+2f); * waypoints.Enqueue(new Vector3(-196.6f, 33.9f, 173.7f)); * //317.9051-257.4592 = 61 * delays.Enqueue(15.5f+2f); * waypoints.Enqueue(new Vector3(-224.9f, 34.2f, 203.6f)); * //368.6794-323.5688 = 46 * delays.Enqueue(12+2f); * waypoints.Enqueue(new Vector3(-276.5f, 34.8f, 252.3f)); * //435.9674-372.0013 = 64 * delays.Enqueue(16+2f); * waypoints.Enqueue(new Vector3(-311.9f, 36.3f, 258.4f));*/ //StartCoroutine(delayAddPL(new Vector3((float)(-4.0),27.3f,(float)(-10.6)),rot,3,waypoints,delays));//first simulation pl location //StartCoroutine(delayAddPL(new Vector3((float)(-23.6),28.0f,(float)(9.8)),rot,3,waypoints,delays));//second simulation pl location to test moving around pl Queue <float> delays = new Queue <float>(); //FIRST STREET: Start PL from -34.7, 35.0, 97.0 //destination: (-170.8, 24.7, -73.6) Queue <Vector3> fwaypoints = new Queue <Vector3>(); //original waypoint towards VPL //fwaypoints.Enqueue(new Vector3(-154.7f, 26.4f, -24.1f)); //second waypoint towards VPL //fwaypoints.Enqueue(new Vector3(-170.8f, 24.7f, -73.6f)); //Updated trial location towards VPL //fwaypoints.Enqueue(new Vector3(-199.4f, 24.7f, -69.3f)); //End point away from VPL fwaypoints.Enqueue(new Vector3(45.2f, 31.2f, 177.1f)); //rotation for going towards VPL //Quaternion frot = Quaternion.Euler(0f,-135.2f,0f); //rotation for going away from VPL Quaternion frot = Quaternion.Euler(0f, 44.636f, 0f); //Location moving towards VPL //StartCoroutine(delayAddPL(new Vector3(-40.3f,30.9f,89.5f),frot,3,fwaypoints,delays)); // Location moving away from VPL //StartCoroutine(delayAddPL(new Vector3(-147.9f, 26.8f, -18.4f),frot,3,fwaypoints,delays)); //SECOND STREET: Start PL from -78.3, 35.0, 123.5 Move to: -197.7, 27.4, -3.4 Queue <Vector3> swaypoints = new Queue <Vector3>(); //original location towards VPL //swaypoints.Enqueue(new Vector3(-197.7f, 27.4f, -3.4f)); //Updated trial location towards VPL //swaypoints.Enqueue(new Vector3(-234.0f, 25.7f, -33.6f)); //End point away from VPL swaypoints.Enqueue(new Vector3(12.4f, 31.5f, 216.8f)); //rotation for going towards VPL //Quaternion srot = Quaternion.Euler(0f,-135.2f,0f); //rotation for going away from VPL Quaternion srot = Quaternion.Euler(0f, 44.636f, 0f); //Location moving towards VPL //StartCoroutine(delayAddPL(new Vector3(-78.3f, 32.5f, 123.5f),srot,3,swaypoints,delays)); //Location moving away from VPL //StartCoroutine(delayAddPL(new Vector3(-187.1f, 28.0f, 14.8f),srot,3,swaypoints,delays)); //THIRD STREET: Start PL from -94.2, 35.0, 176.8 Move to: -221.9, 29.1, 37.2 //New destination: (-324.5, 26.9, -17.3) Queue <Vector3> twaypoints = new Queue <Vector3>(); //first trial location toward VPL //twaypoints.Enqueue(new Vector3(-212.3f, 29.1f, 56.5f)); //updated trial location toward VPL //twaypoints.Enqueue(new Vector3(-292.8f, 26.1f, -30.1f)); //Move out of the way toward VPL //twaypoints.Enqueue(new Vector3(-324.5f, 26.9f, -17.3f)); //End point away from VPL twaypoints.Enqueue(new Vector3(5.9f, 30.6f, 275.3f)); //rotation for going towards VPL //Quaternion trot = Quaternion.Euler(0f,-135.2f,0f); //rotation for going away from VPL Quaternion trot = Quaternion.Euler(0f, 44.636f, 0f); //Location moving towards VPL //StartCoroutine(delayAddPL(new Vector3(-113.6f, 33.2f, 158.2f),trot,3,twaypoints,delays)); //Location moving away from VPL StartCoroutine(delayAddPL(new Vector3(-221.5f, 29.2f, 44.5f), trot, 3, twaypoints, delays)); Invoke("addAOI", 0); //Invoke("MovePLs",4); //move to -6.8 28 -3.2 }