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