public override void HandleCorrect(EquationController equation) { equation.DisplayCorrect(); result.ApplyEquationResult(EquationResult.CreateFromEquation(equation, true)); equation.SelectNewAnswer(); equationsLeft--; }
private string GetScorePartFromEquationResult(EquationResult e) { float[] terms = e.GetTerms(); float term1 = terms[0]; float term2 = terms[1]; bool term2IsNegative = term2 < 0; string op = term2IsNegative ? "-" : "+"; return((e.WasCorrect() ? "✓" : "X") + " " + term1 + " " + op + " " + Mathf.Abs(term2) + " = " + e.GetAnswer()); }
public override void HandleIncorrect(EquationController equation) { // This is their guess if the've guessed the max number of times allowed bool noMoreGuessesLeft = equation.GetNumberOfGuesses() == GameSettings.Instance.ClassicMode_Guesses; // we destroy this equation if it's their last guess equation.DisplayIncorrect(noMoreGuessesLeft); if (noMoreGuessesLeft) { result.ApplyEquationResult(EquationResult.CreateFromEquation(equation, false)); equation.SelectNewAnswer(); equationsLeft--; } }
public int GetBaseScore() { float score = 0; for (int i = 0; i < equationsArray.Count; i++) { EquationResult thisEquation = (EquationResult)equationsArray[i]; if (thisEquation.WasCorrect()) { float[] terms = thisEquation.GetTerms(); float thisScore = Mathf.Abs(terms[0]) + Mathf.Abs(terms[1]) + Mathf.Abs(thisEquation.GetAnswer()); score = score + thisScore; } } return((int)Mathf.Ceil(score)); }
public void ApplyEquationResult(EquationResult equation) { equationsArray.Add(equation); }