public void TestRule() { string message; bool result = gc.EvaluateRule(rule); ScreenSelectionController screenCont = GameObject.FindGameObjectWithTag("ScreenController").GetComponent <ScreenSelectionController>(); if (result) { message = "Rule Correct! Good Job."; screenCont.DisplayMessage(message, SetPuzzleComplete(screenCont, gc)); } else { List <Board> testedExamples = el.GetExamples(); int totalExamples = testedExamples.Count; int numMatching = 0; foreach (Board board in testedExamples) { if (gc.EvaluateExample(board) == rule.Evaluate(board)) { numMatching++; } } message = string.Format("Rule Incorrect. Agreed with solution on {0}/{1} tested examples. Try Again", numMatching, totalExamples); screenCont.DisplayMessage(message, screenCont.HideMessage); } }
UnityEngine.Events.UnityAction SetPuzzleComplete(ScreenSelectionController screenCont, GameController gc) { GameController gcc = gc; ScreenSelectionController ssc = screenCont; return(() => { gcc.SetPuzzleCompleted(); ssc.HideMessage(); ssc.SwapTo(puzzleSelect); }); }
UnityEngine.Events.UnityAction SetPuzzleComplete(ScreenSelectionController screenCont, GameController gc) { GameController gcc = gc; ScreenSelectionController ssc = screenCont; return () => { gcc.SetPuzzleCompleted(); ssc.HideMessage(); ssc.SwapTo(puzzleSelect); }; }