public override int Score() { Transform sol = transform.Find("Solutions"); Arrow[] arrows = transform.GetComponents <Arrow>(); int score = 0; int test = -1; foreach (Solutions s in sol.transform.GetComponents <Solutions>()) { int test0 = s.TestReaction(arrows); if (test0 > test) { test = test0; } } score = test; SolutionDoublets soldoub = sol.GetComponent <SolutionDoublets>(); score += (100 * soldoub.TestSolution()) / soldoub.MaxScore(); Debug.Log("Score : " + (score / 2)); return(score / 2); }
public override void ShowCorrection() { SolutionDoublets soldoub = transform.GetComponentInChildren <SolutionDoublets>(); soldoub.CorrectDoublet(); Solutions[] solutions = transform.Find("Solutions").GetComponents <Solutions>(); Solutions bestSolution; for (int st = 0; st <= stepNumber; st++) // Donne la correction de l'étape st { List <Arrow> arrows = new List <Arrow>(); foreach (Arrow ar in transform.GetComponents <Arrow>()) // On sélectionne uniquement les flèches de l'étape { if (ar.step == st) { arrows.Add(ar); } } int test = -1; bestSolution = null; foreach (Solutions s in solutions) { if (s.step != st) { continue; } int test0 = s.TestReaction(arrows.ToArray()); if (test0 > test) { test = test0; bestSolution = s; } } foreach (Arrow ar in arrows) { if (bestSolution.TestOneArrow(ar)) { ar.SetGood(); } else { ar.SetWrong(); } } bestSolution.CompleteReaction(arrows); } }