/// <summary> /// Compares the answer <see cref="Matrix2x2"/> provided by the Player with the <see cref="solutionMatrix"/>. /// <para> /// The <see cref="ResultText"/> will display whether or not the Player got the right answer. /// This information will be recorded in the Google Sheets for Unity system (GSFU) via <see cref="CloudConnectorCore"/>. /// </para> /// <para> /// Additional information can be sent to the <see cref="MatrixLogger"/> as well. /// </para> /// </summary> /// <param name="answerMatrix">The final answer the User submitted.</param> public void CheckAnswer(Matrix2x2 answerMatrix) { bool isCorrect = Matrix2x2.IsEqual(solutionMatrix, answerMatrix); if (isCorrect) { ResultText.text = "Correct!"; MatrixLogger.Add("Correct! The answer was:\n" + solutionMatrix.ToString()); SubmissionResultPanel.SetActive(true); answertime = Time.timeSinceLevelLoad; CloudConnectorCore.UpdateObjects("playerInfo", "name", Playername, q, answertime.ToString(), true); StopCoroutine("RemoveResultPanelAfterSomeSeconds"); StartCoroutine("RemoveResultPanelAfterSomeSeconds"); } else { MatrixLogger.Add("Incorrect! Your answer was:\n" + answerMatrix.ToString()); ResultText.text = "Incorrect..."; SubmissionResultPanel.SetActive(true); StopCoroutine("RemoveResultPanelAfterSomeSeconds"); StartCoroutine("RemoveResultPanelAfterSomeSeconds"); } }
/// <summary> /// Add the text in the <see cref="InputField"/> to the <see cref="MatrixLogger"/>. /// </summary> public void Add() { string input = InputField.text; input.Trim(); if (!string.IsNullOrEmpty(input)) { MatrixLogger.Add(input); InputField.text = string.Empty; } }
/// <summary> /// Print a <see cref="Matrix2x2"/> to the <see cref="MatrixLogger"/>. /// </summary> public void PrintMatrix() { Matrix2x2 matrix = new Matrix2x2(); MatrixLogger.Add(matrix.ToString()); }