// Use this for initialization void Start() { gng = Camera.main.GetComponent <GNGTestHandler>(); ba = GetComponent <ButtonAssignerGNG>(); if (name.Equals("ArrowButton")) { buttonImage = GetComponent <SpriteRenderer>(); c = buttonImage.color; GetComponent <Collider2D>().enabled = false; } }
public void Continue(int val) { GNGTestHandler gng = Camera.main.GetComponent <GNGTestHandler>(); e = gng.backEndItem.currentEvent.type; if (GameObject.Find("go")) { gng.backEndItem.eventNumber++; return; } bool isCorrect; ClickCardGNG[] c = FindObjectsOfType(typeof(ClickCardGNG)) as ClickCardGNG[]; print(c[0].responseName); if (!GameObject.Find("go") && ((c[0].isClicked && gng.frontEndItem.isCorrect[0]) || (!c[0].isClicked && !gng.frontEndItem.isCorrect[0]))) { isCorrect = true; } else { isCorrect = false; } GNGOutputHandler.correct = isCorrect; GNGOutputHandler.responsePosition = c[0].responsePosition; GNGOutputHandler.responseName = c[0].responseName; if (isCorrect && !gng.backEndItem.currentEvent.jumpLabel.Equals("")) //This jumps from teaching { for (int i = gng.backEndItem.eventNumber + 1; i < gng.backEndItem.events.Length; i++) { if (gng.backEndItem.currentEvent.jumpLabel.Equals(gng.backEndItem.events[i].jumpLabel)) { gng.backEndItem.eventNumber = i; break; } } } else if (!isCorrect && gng.frontEndItem.isExample && !gng.frontEndItem.id.Contains("d")) { gng.backEndItem.eventNumber++; } }
//"This may work, but it might not" - Will P.S. "It might do something" private void OnMouseDown() { print(GNGOutputHandler.timer.ElapsedMilliseconds); GNGTestHandler gng = Camera.main.GetComponent <GNGTestHandler>(); if (GameObject.Find("ArrowButton")) { down = true; ClickCardGNG[] c = FindObjectsOfType(typeof(ClickCardGNG)) as ClickCardGNG[]; c[0].isClicked = true; Camera.main.GetComponent <ContinueButtonGNG>().Continue(0); if (!gng.frontEndItem.isExample) { c[0].hitTimes++; GNGOutputHandler.StopTimer("CPT", gng.frontEndItem.id); } } else { Camera.main.GetComponent <ContinueButtonGNG>().Continue(0); } }
// Update is called once per frame void Update() { GNGTestHandler gng = Camera.main.GetComponent <GNGTestHandler>(); e = gng.backEndItem.currentEvent.type; if (!gng.frontEndItem.id.Contains("B") && !gng.frontEndItem.id.Contains("b")) { gng.frontEndItem.isi = 800; } else if (gng.currentTestNumber < 66 || (gng.currentTestNumber > 138 && gng.currentTestNumber < 198) || (gng.currentTestNumber > 265 && gng.currentTestNumber < 325) || (gng.currentTestNumber > 396 && gng.currentTestNumber < 457)) { gng.frontEndItem.isi = 5000; } else if (gng.currentTestNumber < 127 || (gng.currentTestNumber > 199 & gng.currentTestNumber < 259) || (gng.currentTestNumber > 327 && gng.currentTestNumber < 387) || (gng.currentTestNumber > 457 && gng.currentTestNumber < 518)) { gng.frontEndItem.isi = 500; } if (e == EventSystem.typeOfEvent.Destroy) { isAnim = false; } print(OutputHandler.timer.ElapsedMilliseconds); if (OutputHandler.timer.ElapsedMilliseconds >= gng.frontEndItem.isi && e == EventSystem.typeOfEvent.Mouse && !gng.frontEndItem.isExample) { if (hitTimes == 0) { if (gng.frontEndItem.isCorrect[0]) { GNGOutputHandler.correct = false; GNGOutputHandler.responseName = responseName; Camera.main.GetComponent <ContinueButtonGNG>().Continue(0); GNGOutputHandler.StopTimer("CPT", gng.frontEndItem.id); } else { GNGOutputHandler.correct = true; GNGOutputHandler.responseName = responseName; Camera.main.GetComponent <ContinueButtonGNG>().Continue(0); GNGOutputHandler.StopTimer("CPT", gng.frontEndItem.id); } } gng.LoadNextTest(); } if (e == EventSystem.typeOfEvent.Mouse && gng.frontEndItem.isExample && gng.frontEndItem.wordPictures.Length > 0) { //This keeps the Continue function in ContinueButton script from running again corrected = false; } if (e == EventSystem.typeOfEvent.loop) { ClickCardGNG[] c = FindObjectsOfType(typeof(ClickCardGNG)) as ClickCardGNG[]; c[0].isClicked = false; } if (OutputHandler.timer.ElapsedMilliseconds >= 5000 && gng.frontEndItem.isExample && !corrected) { print(gng.frontEndItem.isCorrect.Length); if (gng.frontEndItem.isCorrect[0]) { //Missed hit GNGOutputHandler.correct = false; corrected = true; Camera.main.GetComponent <ContinueButtonGNG>().Continue(0); } else if (!gng.frontEndItem.isCorrect[0]) { //Appropriate no hit GNGOutputHandler.correct = true; Camera.main.GetComponent <ContinueButtonGNG>().Continue(0); } } }