// Use this for initialization void Start() { cam =GameObject.Find("CardboardMain"); if(gender ==0){ genderBasedAnim = GetComponent<Animation>()["MaleArm|Walking"]; }else{ //TODO rename walkig_grete to walking_grete in Blender file genderBasedAnim = GetComponent<Animation>()["FemaleArm|walkig_grete"]; } last = positions.Last; iterator = positions.First; //gameObject.AddComponent<BoxCollider>(); transform.Rotate (0,90,0); //sets the color for the pedestrians /*myColor = Color.red; GetComponentInChildren<Renderer>().materials[1].color = myColor;*/ pc = GameObject.Find ("PlaybackControl").GetComponent<PlaybackControlNonGUI> (); r = GetComponentInChildren<Renderer>() as Renderer; //set Tag of the game object in order to find gameobjects with the same tag //gameObject.tag = "pedestrian"; }
void Awake() { if (lowQualPedModel) { //Model based on http://opengameart.org/content/base-human-models-low-poly by Clint Bellanger ped1 = Resources.Load ("Hans_easy"); ped2 = Resources.Load ("Grete_easy"); } else { ped1 = Resources.Load("Hans"); ped2 = Resources.Load("Grete"); } pc = GameObject.Find("PlaybackControl").GetComponent<PlaybackControlNonGUI>(); Pedestrians = new GameObject("Pedestrians"); }
void Start() { pc = GameObject.Find ("PlaybackControl").GetComponent<PlaybackControlNonGUI> (); //cameraObj = GameObject.Find ("Sphere"); //160ish total_time in big tent //waypoints by @Xaverl: addWaypoint(39, 5, 50, -5f); addWaypoint(39, 2, 0, -4f); addWaypoint(39, 2, 17, 0.4f); addWaypoint(19, 2, 17, 0.2f); addWaypoint(19, 2, 39, 0.6f); addWaypoint (0, 5, 39, -5f); addWaypoint(19, 2, 39, 0.5f); addWaypoint(19, 2, 64, 0.5f); addWaypoint(39, 2, 64, 0.5f); addWaypoint(39, 4, 82, -2f); addWaypoint(0, 6, 82, -5f); addWaypoint(39, 5, 50, -3f); /* addWaypoint (0, 7, 5, 0f); addWaypoint (5, 7, 5, -1.5f); addWaypoint (5, 7, -5, 0.4f); addWaypoint (5, 12, -5, 0f); */ if (times [0] < 0) // because i starts at 1 in for loop addWaitSection (waypoints [0], Math.Abs(times [0])); for (int i = 1; i < waypoints.Count; i ++) { Vector3 startWaypoint = waypoints [i - 1]; float velocReducerStart = times[i - 1] < 0 ? 0 : times[i - 1]; // below 0 means waiting time Vector3 endWaypoint = waypoints [i]; float velocReducerEnd = times[i] < 0 ? 0 : times[i]; float dist = Vector3.Distance (startWaypoint, endWaypoint); //Debug.Log ("dist: " + dist); float s_accel = dist * accelEndMarkerPerc; float s_decel = dist - (dist * decelStartMarkerPerc); float s_const = dist - s_accel - s_decel; //Debug.Log (string.Concat("s_accel: ", s_accel, " s_const: ", s_const, " s_decel: ", s_decel)); Vector3 accelEndPoint = Vector3.Lerp (startWaypoint, endWaypoint, accelEndMarkerPerc); Vector3 decelStartPoint = Vector3.Lerp (startWaypoint, endWaypoint, decelStartMarkerPerc); Section accelSect = new Section(sections.Count, Section.Type.ACCELERATION, startWaypoint, accelEndPoint, velocReducerStart, s_ges, s_accel); //Debug.Log ("ACCEL-SECT: " + accelSect); sections.Add(accelSect); Section constSect = new Section(sections.Count, Section.Type.CONSTANT, accelEndPoint, decelStartPoint, 1, s_ges + s_accel, s_const); //Debug.Log ("CONST-SECT: " + constSect); sections.Add(constSect); Section decelSect = new Section(sections.Count, Section.Type.DECELERATION, decelStartPoint, endWaypoint, velocReducerEnd, s_ges + s_accel + s_const, s_decel); //Debug.Log ("DECEL-SECT: " + decelSect); sections.Add(decelSect); if (times [i] < 0) addWaitSection (waypoints [i], Math.Abs(times [i])); s_ges += dist; } }