private void FixedUpdate() { if (spinning && Time.time >= nextSpinFinish) { spinning = false; var creditsWon = 0; // Get current combination to check prizes with in the top line. var combination = new List <Figure>(); foreach (var reelParent in reelControls) { combination.Add(reelParent.GetComponent <ReelControl>().GetFirstFigure()); } var winMatches = winChecker.MatchPrize(combination); if (winMatches.Count > 0) { // Only checking the first match on the line. var boxes = new List <GameObject>(); foreach (Transform box in line1Boxes.transform) { boxes.Add(box.gameObject); } boxes[0].GetComponent <WinBoxControl>().DrawStartContinuingBox(); var match = winMatches[0]; for (var i = match.start + 1; i < match.length - 1; i++) { boxes[i].GetComponent <WinBoxControl>().DrawContinuation(); } boxes[match.length - 1].GetComponent <WinBoxControl>().DrawEnd(); creditsWon += match.credits; } // Now in the center. combination = new List <Figure>(); foreach (var reelParent in reelControls) { combination.Add(reelParent.GetComponent <ReelControl>().GetCentralFigure()); } winMatches = winChecker.MatchPrize(combination); if (winMatches.Count > 0) { // Only checking the first match on the line. var boxes = new List <GameObject>(); foreach (Transform box in line2Boxes.transform) { boxes.Add(box.gameObject); } boxes[0].GetComponent <WinBoxControl>().DrawStartContinuingBox(); var match = winMatches[0]; for (var i = match.start + 1; i < match.length - 1; i++) { boxes[i].GetComponent <WinBoxControl>().DrawContinuation(); } boxes[match.length - 1].GetComponent <WinBoxControl>().DrawEnd(); creditsWon += match.credits; } // Finally the bottom line. combination = new List <Figure>(); foreach (var reelParent in reelControls) { combination.Add(reelParent.GetComponent <ReelControl>().GetThirdFigure()); } winMatches = winChecker.MatchPrize(combination); if (winMatches.Count > 0) { // Only checking the first match on the line. var boxes = new List <GameObject>(); foreach (Transform box in line3Boxes.transform) { boxes.Add(box.gameObject); } boxes[0].GetComponent <WinBoxControl>().DrawStartContinuingBox(); var match = winMatches[0]; for (var i = match.start + 1; i < match.length - 1; i++) { boxes[i].GetComponent <WinBoxControl>().DrawContinuation(); } boxes[match.length - 1].GetComponent <WinBoxControl>().DrawEnd(); creditsWon += match.credits; } winningText.text = "Credits won: " + creditsWon; } }