// Use this for initialization void Start() { thePlane = GameObject.Find("Plane"); planeScript = thePlane.GetComponent <addPlanes>(); index = planeScript.queue.Count; startPoint = transform.position; startTime = Time.time; endPoint = new Vector3(0, 0, 0); }
// Use this for initialization void Start() { //if (gameObject.name == "initPlane") // Destroy (this); thePlane = GameObject.Find("Plane"); planeScript = thePlane.GetComponent <addPlanes>(); index = planeScript.queue.Count; startPoint = transform.position; startTime = Time.time; endPoint = new Vector3(0, 0, 0); System.Random random = new System.Random(); string lane = null; WWW www = GET("https://atcvrservplanegrid-fbrkysyfnd.now.sh/lane"); string json = www.text; Debug.Log(json); char[] delimiterChars = { ':', ',', '"', '{', '}' }; string [] words = json.Split(delimiterChars); string laneVal = words[5]; int planeVal = Int32.Parse(words [10]); Debug.Log(laneVal); Debug.Log(planeVal); lane = laneVal; string switchVal; if (buttonPressed()) { switchVal = laneVal; } switchVal = laneVal; switch (switchVal) { case "a": laneA(); break; case "b": laneB(); break; case "c": laneC(); break; } }
// Use this for initialization. void Start() { thePlane = GameObject.Find("Plane"); planeScript = thePlane.GetComponent <addPlanes>(); index = planeScript.queue.Count; startPoint = transform.position; startTime = Time.time; endPoint = new Vector3(0, 0, 0); System.Random rand = new System.Random(); if (rand.Next(5) == 1) { emergency = true; emergencyTimer = 0F; Debug.Log("Heart Attack on Plane" + index); Renderer renderer = gameObject.GetComponent <Renderer> (); Material newMat = Resources.Load("airplane_02", typeof(Material)) as Material; renderer.material = newMat; } }
// Use this for initialization void Start() { //if (gameObject.name == "initPlane") // Destroy (this); thePlane = GameObject.Find("Plane"); planeScript = thePlane.GetComponent<addPlanes>(); index = planeScript.queue.Count; startPoint = transform.position; startTime = Time.time; endPoint = new Vector3 (0, 0, 0); System.Random random = new System.Random(); switch (random.Next (0, 3)) { case 0: laneA (); break; case 1: laneB (); break; case 2: laneC(); break; } }