void setNextTestItem() { base.backEndItem = base.testItemBackEnd[base.currentTestNumber]; frontEndItem = testItemFrontEnd[base.currentTestNumber]; base.nextTest = false; }
public void CreateTest(CompTestItem t) { //this will give us the world unit width of the screen (doubled it to account for the negative side) float fullScreenWidth = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2; //divide the screen width by the amount of objects in the array to get offset from left side float fullScreenHeight = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2; float offsetX = fullScreenWidth / t.TriggerPos.Length; float offsetY = fullScreenHeight / 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("reset"); 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); } float leftScreenPos = -fullScreenWidth / 2 + offsetX / 2; float topScreenPos = fullScreenHeight / 2 - offsetY / 2; GameObject[] checkers = new GameObject[t.TriggerPos.Length]; for (int i = 0; i < t.TriggerPos.Length; i++) { offsetX = fullScreenWidth / 10; //from center, pick distance, i-(arrayLength/2) * distance between cards + arrayLength%2 == 1?0:distance/2 //ToDo: Change this math everywhere (all other handlers) float dist = fullScreenHeight / 5f; o = Instantiate(t.TriggerPos[i], new Vector3((i - t.TriggerPos.Length / 2) * dist + (t.TriggerPos.Length % 2 != 0?0:dist / 2), topScreenPos, 0), new Quaternion()); o.GetComponent <SeqCardChecker>().shapeNumber = t.OrderOfShapes[i]; o.GetComponent <SeqCardChecker>().inputNumber = t.OrderOfInput[i]; o.GetComponent <SeqCardChecker>().usesOrder = t.useOrder; checkers[i] = o; o.name = "Trigger" + t.OrderOfShapes[i] + " clone"; o.transform.localScale = Vector3.one * fullScreenHeight / 10f * 1.5f; } Camera.main.GetComponent <TestChecker>().SetCheckers(checkers); offsetX = fullScreenWidth / t.SortShape.Length; offsetY = fullScreenHeight / 2; leftScreenPos = -fullScreenWidth / 2 + offsetX / 2; topScreenPos = fullScreenHeight / 2 - offsetY / 2; for (int i = 0; i < t.SortShape.Length; i++) { float dist = fullScreenWidth / 8f; float posX; if (i < 4) { int width = (t.SortShape.Length > 4 ? 4 : t.SortShape.Length); posX = (i - width / 2) * dist + (width % 2 != 0 ? 0 : dist / 2); o = Instantiate(t.SortShape[i], new Vector3(posX, -topScreenPos, 0), new Quaternion()); o.GetComponent <CardObject>().orderNumber = i; o.name = "Sort" + i + " clone"; o.transform.localScale = Vector3.one * fullScreenHeight / 10f * 1.5f; o = new GameObject(); o.transform.position = new Vector3(posX, -topScreenPos, 0); o.name = "Origin" + i + " clone"; o.transform.localScale = Vector3.one * fullScreenHeight / 10f * 1.5f; } else { int width = (t.SortShape.Length - 4 > 4 ? 4 : t.SortShape.Length - 4); posX = ((i - 4) - width / 2) * dist + (width % 2 != 0 ? 0 : dist / 2); o = Instantiate(t.SortShape[i], new Vector3(posX, 0, 0), new Quaternion()); o.GetComponent <CardObject>().orderNumber = i; o.name = "Sort" + i + " clone"; o.transform.localScale = Vector3.one * fullScreenHeight / 10f * 1.5f; o = new GameObject(); o.transform.position = new Vector3(posX, 0, 0); o.name = "Origin" + i + " clone"; o.transform.localScale = Vector3.one * fullScreenHeight / 10f * 1.5f; } } //SeqLangOutputHandler.StartTimer(0); }