//Submits answer when button is pressed. public void submitAnswer() { //If the answer is correct... if (cSel1 && cSel2 && cSel3 && cSel4 && cSel5) { sAnswer.gameObject.SetActive(false); //Submit Button is replaced... nQuestion.gameObject.SetActive(true); //...By Next Question Button. hint.gameObject.SetActive(false); //hint button disables if question is answered correctly. corInc.text = "That's The Way!"; levelManager.addMuscPlaced(); rs.reportSelf(); if (correctFirstTry) { levelManager.testScoreAddition(); } //Evaluates the number of guesses and gives points accordingly. if (myGuess == THRESH0) { levelManager.score += SCORE1; } else if (myGuess == THRESH1) { levelManager.score += SCORE2; } else if (myGuess == THRESH2 && myHint == false) { levelManager.score += SCORE3; } else if (myGuess > THRESH3 && myHint == false) { levelManager.score += SCORE0; } else if (myHint == true) { levelManager.score += SCORE0; } } else { //Increases the guesses by 1 for each incorrect guess. myGuess++; rs.addGuess(); levelManager.attempts++; rs.reportSelf(); correctFirstTry = false; if (myHint == false) { corInc.text = "That's not what this muscle does!"; } } if (myGuess >= 2) { hint.gameObject.SetActive(true); //Reveal a button to give the answer... } }
//When the mouse button is released... void OnMouseUp() { if (isClickable && levelManager.gethasStarted() == true && !levelManager.canvasOpen && levelManager.noObjections) { //Enable the Sprite Hint button when guesses exceed 11. May need to be redone. if (rs.getGuesses() >= 11) { hint2Toggle.gameObject.SetActive(true); } getPosx(); //Get the X position and check compared to the correct X position. getPosy(); //Get the Y position and check compared to the correct Y position. clearBools(); //If incorrect, ensure that the booleans are cleared. rs.reportSelf(); //Updates the reportSelf script with the number of guesses, whether the object was placed, and if a hint was used. if (xPos && yPos) //If the X and Y positions are both correct... { hintBox.enabled = false; //Turn off the hint box if it was on. polyCol.enabled = false; //Disable the polygon collider so it's not in any other objects' way. hintBox.color = new Color(1f, 1f, 1f, 0f); //Clears hint box if it is active. setPos(); //Lock object in place if X AND Y positions are in place. hint2Toggle.gameObject.SetActive(false); //Set image hint button toggle to inactive. if (rs.getHint() == true) { rs.toggleHintFalse(); //Set hint 2 bool back to false. } //Opens up the first question when object is placed correctly. Note that for now, code is as if there will always be 1 question asked. if (normal) { quizP.setCanvas(0, true); //Open up the canvas levelManager.addobjPlaced(); } else { //Otherwise reduce the number of objects left to place by 1. levelManager.startObjects--; levelManager.addobjPlaced(); } } } }
//Submits answer when button is pressed. public void submitAnswer() { //If the answer is correct... if (answers1.value == qr1.getValue()) { sAnswer.gameObject.SetActive(false); nQuestion.gameObject.SetActive(true); hint.gameObject.SetActive(false); //hint button disables if question is answered correctly. corInc.text = "You Got It!"; transform.gameObject.tag = "Placed"; levelManager.addobjPlaced(); rs.reportSelf(); //Evaluates the number of guesses and gives points accordingly. if (myGuess == THRESH0) { levelManager.score += SCORE1; } else if (myGuess == THRESH1) { levelManager.score += SCORE2; } else if (myGuess == THRESH2 && myHint == false) { levelManager.score += SCORE3; } else if (myGuess > THRESH3 && myHint == false) { levelManager.score += SCORE0; } else if (myHint == true) { levelManager.score += SCORE0; } } else if (answers1.value != qr1.getValue() && answers1.value != 0) { //Increases the guesses by 1 for each incorrect guess. myGuess++; if (SceneManager.GetActiveScene().name != "UpperArm6B") { rs.addGuess(); } else if (SceneManager.GetActiveScene().name == "UpperArm6B") { rs.addQguess(); } levelManager.attempts++; rs.reportSelf(); if (myHint == false) { corInc.text = "Please try again."; } } else if (answers1.value == 0) { //If player selects the null answer, change the text. if (myHint == false) { corInc.text = "Please select an answer before submitting."; } } if (myGuess >= THRESH2) { hint.gameObject.SetActive(true); //Reveal a button to give the answer... } }