public createLine ( int candNum, string candName ) : void | ||
candNum | int | |
candName | string | |
return | void |
// Use this for initialization void Start() { GameObject cart = GameObject.Find("Cart"); // cart GameObject slot = GameObject.Find("CartSlot"); // slot for cart to fit into on first graph GameObject slot2 = GameObject.Find("CartSlot1"); // slot for cart to fit into on second graph GameObject slot3 = GameObject.Find("CartSlot2"); // slot for cart to fit into on third graph // grab necessary billboard graph elements line2DPrefab = Resources.Load ("prefabs/UI LineRenderer") as GameObject; graphCanvas = GameObject.Find ("GraphCanvas"); createLine = cart.GetComponent<CreateLine>(); for (int i = 0; i < 3; i++) { createLine.createLine (i, CSVReader.topThreeCandidates [i]); } //createLine.createLine(2, "Palin"); // create 1st graph that cart can ride on //createLine.createLine(0, "Gingrich"); // create 2nd graph that cart can ride on //createLine.createLine(1, "Romney"); // create 3rd graph that cart can ride on GameObject line1 = Instantiate (line2DPrefab); GameObject line2 = Instantiate (line2DPrefab); GameObject line3 = Instantiate (line2DPrefab); line1.GetComponent<Make2DLine> ().Initialize (createLine.Positions2, CSVReader.topThreeCandidates [0]); line2.GetComponent<Make2DLine> ().Initialize (createLine.Positions1, CSVReader.topThreeCandidates [1]); line3.GetComponent<Make2DLine> ().Initialize (createLine.Positions3, CSVReader.topThreeCandidates [2]); Make2DLine.followParent (line1, graphCanvas); Make2DLine.followParent (line2, graphCanvas); Make2DLine.followParent (line3, graphCanvas); // load timeline prefab if (timelinePrefab == null) { timelinePrefab = (GameObject)Resources.Load ("prefabs/TimelineCanvas"); } // create a timeline GameObject midTimelineR = (GameObject)Instantiate( timelinePrefab, // positions this 1/10 between the left and center line new Vector3(Mathf.Lerp(createLine.Positions1[0].x, createLine.Positions3[0].x, 0.1f), 0f, 0f), Quaternion.AngleAxis(270f, Vector3.up)); midTimelineR.GetComponent<CoasterTimeline> ().Initialize(createLine.Positions1); slot.transform.position = createLine.Positions1[0];//initiate camera location to first point slot.transform.LookAt(createLine.Positions1[1]);//initiate camera aim to second point currentPercent = createLine.Positions1[0][1]; nextPercent = createLine.Positions1[1][1]; Debug.Log(currentPercent); slot2.transform.position = createLine.Positions2[0];//initiate camera location to first point slot2.transform.LookAt(createLine.Positions2[1]);//initiate camera aim to second point currentPercent = createLine.Positions2[0][1]; nextPercent = createLine.Positions2[1][1]; Debug.Log(currentPercent); slot3.transform.position = createLine.Positions3[0];//initiate camera location to first point slot3.transform.LookAt(createLine.Positions3[1]);//initiate camera aim to second point currentPercent = createLine.Positions3[0][1]; nextPercent = createLine.Positions3[1][1]; Debug.Log(currentPercent); waypointCart = createLine.Positions1[1]; //initiate travel-to point to second point candPositions = createLine.Positions1; waypointCart1 = createLine.Positions2[1]; //initiate travel-to point to second point candPositions1 = createLine.Positions2; waypointCart2 = createLine.Positions3[1]; //initiate travel-to point to second point candPositions2 = createLine.Positions3; //boost = createLine.boost; currentDate = createLine.Position1Dates[0].Date.ToString("d"); nextDate = createLine.Position1Dates[1].Date.ToString("d"); currentCandidate = createLine.Position1Candidate; pause = 1; }
// Use this for initialization void Start() { GameObject cart = GameObject.Find("Cart"); // cart GameObject slot = GameObject.Find("CartSlot"); // slot for cart to fit into on first graph GameObject slot2 = GameObject.Find("CartSlot1"); // slot for cart to fit into on second graph GameObject slot3 = GameObject.Find("CartSlot2"); // slot for cart to fit into on third graph // grab necessary billboard graph elements line2DPrefab = Resources.Load("prefabs/UI LineRenderer") as GameObject; graphCanvas = GameObject.Find("GraphCanvas"); createLine = cart.GetComponent <CreateLine>(); for (int i = 0; i < 3; i++) { createLine.createLine(i, CSVReader.topThreeCandidates [i]); } //createLine.createLine(2, "Palin"); // create 1st graph that cart can ride on //createLine.createLine(0, "Gingrich"); // create 2nd graph that cart can ride on //createLine.createLine(1, "Romney"); // create 3rd graph that cart can ride on GameObject line1 = Instantiate(line2DPrefab); GameObject line2 = Instantiate(line2DPrefab); GameObject line3 = Instantiate(line2DPrefab); line1.GetComponent <Make2DLine> ().Initialize(createLine.Positions2, CSVReader.topThreeCandidates [0]); line2.GetComponent <Make2DLine> ().Initialize(createLine.Positions1, CSVReader.topThreeCandidates [1]); line3.GetComponent <Make2DLine> ().Initialize(createLine.Positions3, CSVReader.topThreeCandidates [2]); Make2DLine.followParent(line1, graphCanvas); Make2DLine.followParent(line2, graphCanvas); Make2DLine.followParent(line3, graphCanvas); // load timeline prefab if (timelinePrefab == null) { timelinePrefab = (GameObject)Resources.Load("prefabs/TimelineCanvas"); } // create a timeline GameObject midTimelineR = (GameObject)Instantiate( timelinePrefab, // positions this 1/10 between the left and center line new Vector3(Mathf.Lerp(createLine.Positions1[0].x, createLine.Positions3[0].x, 0.1f), 0f, 0f), Quaternion.AngleAxis(270f, Vector3.up)); midTimelineR.GetComponent <CoasterTimeline> ().Initialize(createLine.Positions1); slot.transform.position = createLine.Positions1[0]; //initiate camera location to first point slot.transform.LookAt(createLine.Positions1[1]); //initiate camera aim to second point currentPercent = createLine.Positions1[0][1]; nextPercent = createLine.Positions1[1][1]; Debug.Log(currentPercent); slot2.transform.position = createLine.Positions2[0]; //initiate camera location to first point slot2.transform.LookAt(createLine.Positions2[1]); //initiate camera aim to second point currentPercent = createLine.Positions2[0][1]; nextPercent = createLine.Positions2[1][1]; Debug.Log(currentPercent); slot3.transform.position = createLine.Positions3[0]; //initiate camera location to first point slot3.transform.LookAt(createLine.Positions3[1]); //initiate camera aim to second point currentPercent = createLine.Positions3[0][1]; nextPercent = createLine.Positions3[1][1]; Debug.Log(currentPercent); waypointCart = createLine.Positions1[1]; //initiate travel-to point to second point candPositions = createLine.Positions1; waypointCart1 = createLine.Positions2[1]; //initiate travel-to point to second point candPositions1 = createLine.Positions2; waypointCart2 = createLine.Positions3[1]; //initiate travel-to point to second point candPositions2 = createLine.Positions3; //boost = createLine.boost; currentDate = createLine.Position1Dates[0].Date.ToString("d"); nextDate = createLine.Position1Dates[1].Date.ToString("d"); currentCandidate = createLine.Position1Candidate; pause = 1; }