public void CreateTest(RYMTestItem t) { float fullScreenHeight = Camera.main.orthographicSize * 2; float fullScreenWidth = fullScreenHeight * 16 / 9; // basically height * screen aspect ratio //this will give us the world unit width of the screen (doubled it to account for the negative side) //divide the screen width by the amount of objects in the array to get offset from left side //changed this to fix something, make sure it didn't break everything else float offsetX = fullScreenWidth / (t.LetterButtons.Length + 2); float offsetY = fullScreenHeight / 2; float leftScreenPos = -fullScreenWidth / 2 + offsetX / 2; float topScreenPos = fullScreenHeight / 2 - offsetY / 2; GameObject o; if (!GameObject.Find("origin")) { o = new GameObject("origin"); o.transform.position = new Vector3(0, -offsetY / 2, 0); TextMesh tm = o.AddComponent <TextMesh>(); tm.alignment = TextAlignment.Center; tm.anchor = TextAnchor.MiddleCenter; tm.fontSize = 100; tm.color = Color.black; o.transform.localScale = Vector3.one * fullScreenHeight / 6f; o = new GameObject("topOrigin"); o.transform.position = new Vector3(0, offsetY / 2, 0); tm = o.AddComponent <TextMesh>(); tm.alignment = TextAlignment.Center; tm.anchor = TextAnchor.MiddleCenter; tm.fontSize = 100; tm.color = Color.black; o.transform.localScale = Vector3.one * fullScreenHeight / 6f; //o.layer = LayerMask.NameToLayer("fade"); o = new GameObject("midOrigin"); o.transform.position = new Vector3(0, 0, 0); tm = o.AddComponent <TextMesh>(); tm.alignment = TextAlignment.Center; tm.anchor = TextAnchor.MiddleCenter; tm.fontSize = 100; tm.color = Color.black; o.transform.localScale = Vector3.one * fullScreenHeight / 6f; //o.layer = LayerMask.NameToLayer("fade"); o = new GameObject("audio"); o.transform.position = new Vector3((-fullScreenWidth / 16) * 5, -offsetY / 2, 0); o = new GameObject("arrow"); o.transform.position = new Vector3((fullScreenWidth / 16) * 5, -offsetY / 2, 0); } for (int i = 0; i < t.LetterButtons.Length; i++) { offsetX = fullScreenWidth / 5; float scale = fullScreenHeight / 10f * 3f; o = Instantiate(t.LetterButtons[i], new Vector3(leftScreenPos + offsetX * ((i * 2) + 1), 0, 0), new Quaternion()); o.layer = LayerMask.NameToLayer("fadeOut"); if (t.isCorrect[i]) { o.name = "correct clone"; } else { o.name = "incorrect clone"; } GameObject child = new GameObject("image"); SpriteRenderer s = child.AddComponent <SpriteRenderer>(); s.sortingOrder = 0; s.sprite = t.wordPictures[i]; child.transform.parent = o.transform; child.transform.localPosition = new Vector3(0, 0, 0); o.GetComponent <ClickCardRYM>().isCorrect = t.isCorrect[i]; o.GetComponent <ClickCardRYM>().responsePosition = i + 1; o.GetComponent <ClickCardRYM>().responseName = t.wordPictures[i].name; o.transform.localScale = Vector3.one * scale; //GameObject.Destroy(o.transform.GetChild(0).gameObject); } //if (!t.skipPrint) // //may need to be 0, check if resetTimer // RYMOutputHandler.StartTimer(0); }
void setNextTestItem() { base.backEndItem = base.testItemBackEnd[base.currentTestNumber]; frontEndItem = testItemFrontEnd[base.currentTestNumber]; base.nextTest = false; }