void OnMouseDown() { SITestHandler si = Camera.main.GetComponent <SITestHandler>(); if (si.frontEndItem.isExample && GameObject.Find("ArrowButton")) { return; } if (e == EventSystem.typeOfEvent.Mouse) { isClicked = !isClicked; foreach (ClickCardSI c in FindObjectsOfType(typeof(ClickCardSI)) as ClickCardSI[]) { if (!c.Equals(this)) { c.isClicked = false; } } if (!si.frontEndItem.isExample) { GameObject.Find("ArrowButton").GetComponent <Button>().interactable = isClicked; } else { Camera.main.GetComponent <ContinueButtonSI>().Continue(0); } } }
// Update is called once per frame void Update() { SITestHandler si = Camera.main.GetComponent <SITestHandler>(); e = si.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; //} //} }
// Use this for initialization void Start() { si = Camera.main.GetComponent <SITestHandler>(); }
public void Continue(int val) { SITestHandler si = Camera.main.GetComponent <SITestHandler>(); e = si.backEndItem.currentEvent.type; bool isCorrect = false; foreach (ClickCardSI c in FindObjectsOfType(typeof(ClickCardSI)) as ClickCardSI[]) { if (c.isClicked) { clickedCard = c; isCorrect = c.isCorrect; break; } } print("hit"); SIOutputHandler.correct = isCorrect; SIOutputHandler.responsePosition = clickedCard.responsePosition; SIOutputHandler.responseName = clickedCard.responseName; if (GameObject.Find("ArrowButton") && val == 1) { GameObject.Find("ArrowButton").GetComponent <Button>().interactable = false; si.backEndItem.eventNumber++; return; } if (isCorrect && !si.backEndItem.currentEvent.jumpLabel.Equals("")) { for (int i = si.backEndItem.eventNumber + 1; i < si.backEndItem.events.Length; i++) { if (si.backEndItem.currentEvent.jumpLabel.Equals(si.backEndItem.events[i].jumpLabel)) { si.backEndItem.eventNumber = i; break; } } } else if (!GameObject.Find("ArrowButton")) { if (!isCorrect && si.frontEndItem.isExample) { foreach (ClickCardSI c in FindObjectsOfType(typeof(ClickCardSI)) as ClickCardSI[]) { if (c.isCorrect) { c.isAnim = true; } c.isClicked = false; } si.backEndItem.eventNumber++; } else { foreach (ClickCardSI c in FindObjectsOfType(typeof(ClickCardSI)) as ClickCardSI[]) { c.isClicked = false; } si.backEndItem.eventNumber++; } } }