// Start is called before the first frame update void Start() { answer_recived = null; question_frame = GetComponentInParent <_question_frame>(); for (int i = 0; i < transform.parent.childCount; i++) { if (transform.parent.GetChild(i).name.Equals("Spawner")) { holders = transform.parent.GetChild(i).GetComponent <_spawner>().holders; correct_letters = transform.parent.GetChild(i).GetComponent <_spawner>().letters_in_order; break; } } display_hint = false; hint_button_time = Time.time; hint_time = 0; hint_button_active = false; hint_count = 0; correct_ans = false; answer_complet = false; correct_ans_time = 0; correct_ans_on_screen = false; correct_ans_shown = false; correct_popup.SetActive(false); wrong_popup.SetActive(false); }
private void update_data(_question_frame frame)//update frame data { //if (data.obj != frame.obj) { data.correct_answer = frame.data.correct_answer; data.answer_got = frame.data.answer_got; data.obj = frame.data.obj; data.score += frame.data.score; data.no_of_hints += frame.data.no_of_hints; Debug.Log("score-" + data.score); if (data.correct_answer == data.answer_got) { data.total_correct_ans++; //Debug.Log("score-" + data.total_correct_ans); } else { data.total_incorrect_ans++; } save_data(); frame.data_updated = true; } }
private void Update() //for each frame update { _question_frame current_frame = active_frame.GetComponent <_question_frame>(); //get script "_question_frame" of current frame if (!current_frame.isactive) //is current frame active { if (current_frame.data_updated == false) //is data if current frame is updated { update_data(current_frame); //if not update } next.SetActive(true); //activate next button } else { next.SetActive(false); //if frame is active next button off data_updated = false; //data is not updated } if (Input.GetKeyDown(KeyCode.Escape))//if escape, get to previous scene { SceneManager.LoadScene(0); } }