void OnMouseDown() { OCTestHandler OC = Camera.main.GetComponent <OCTestHandler>(); if (OC.frontEndItem.isExample && GameObject.Find("ArrowButton")) { return; } if (e == EventSystem.typeOfEvent.Mouse) { isClicked = !isClicked; foreach (ClickCardOC c in FindObjectsOfType(typeof(ClickCardOC)) as ClickCardOC[]) { if (!c.Equals(this)) { c.isClicked = false; } } if (!OC.frontEndItem.isExample) { GameObject.Find("ArrowButton").GetComponent <Button>().interactable = isClicked; } else { Camera.main.GetComponent <ContinueButtonOC>().Continue(0); } } }
// Update is called once per frame void Update() { OCTestHandler oc = Camera.main.GetComponent <OCTestHandler>(); e = oc.backEndItem.currentEvent.type; if (e == EventSystem.typeOfEvent.Destroy) { isAnim = false; } //get name of test //if its rhyming then do white //if(!LI.testAbbrev.Equals("RYM")) //{ GameObject border = transform.Find("GameObject").gameObject; if (isClicked) { border.GetComponent <SpriteRenderer>().color = Color.yellow; } else if (isAnim) { border.GetComponent <SpriteRenderer>().color = Color.green; } else { border.GetComponent <SpriteRenderer>().color = new Color(41f / 255f, 171f / 255f, 226f / 255f); } //} //else //{ //GameObject button = transform.gameObject; //if(button.GetComponent<SpriteRenderer>()) //{ // if (isClicked) // button.GetComponent<SpriteRenderer>().color = Color.gray; // else if (isAnim) // button.GetComponent<SpriteRenderer>().color = Color.green; // else // button.GetComponent<SpriteRenderer>().color = Color.white; //} //} }
public void Continue(int val) { OCTestHandler oc = Camera.main.GetComponent <OCTestHandler>(); e = oc.backEndItem.currentEvent.type; bool isCorrect = false; foreach (ClickCardOC c in FindObjectsOfType(typeof(ClickCardOC)) as ClickCardOC[]) { if (c.isClicked) { clickedCard = c; isCorrect = c.isCorrect; break; } } print("hit"); OCOutputHandler.correct = isCorrect; OCOutputHandler.responsePosition = clickedCard.responsePosition; OCOutputHandler.responseName = clickedCard.responseName; if (GameObject.Find("ArrowButton") && val == 1) { GameObject.Find("ArrowButton").GetComponent <Button>().interactable = false; oc.backEndItem.eventNumber++; return; } if (isCorrect && !oc.backEndItem.currentEvent.jumpLabel.Equals("")) { for (int i = oc.backEndItem.eventNumber + 1; i < oc.backEndItem.events.Length; i++) { if (oc.backEndItem.currentEvent.jumpLabel.Equals(oc.backEndItem.events[i].jumpLabel)) { oc.backEndItem.eventNumber = i; break; } } } else if (!GameObject.Find("ArrowButton")) { if (!isCorrect && oc.frontEndItem.isExample) { foreach (ClickCardOC c in FindObjectsOfType(typeof(ClickCardOC)) as ClickCardOC[]) { if (c.isCorrect) { c.isAnim = true; } c.isClicked = false; } oc.backEndItem.eventNumber++; } else { foreach (ClickCardOC c in FindObjectsOfType(typeof(ClickCardOC)) as ClickCardOC[]) { c.isClicked = false; } oc.backEndItem.eventNumber++; } } }
// Use this for initialization void Start() { oc = Camera.main.GetComponent <OCTestHandler>(); }