private void SetupSuitCases() { Debug.Log("Number of suitcases: " + game.suitcases.Count); playSuitcaseSound = true; List <ILivingLetterData> tempCorrect = correctAnswers.ToList(); for (int i = 0; i < game.suitcases.Count; i++) { ScannerSuitcase ss = game.suitcases[i]; ss.Reset(true); if (tempCorrect.Count > 0 && wrongAnswers.Count > 0) { int coinFlip = UnityEngine.Random.Range(1, 5); if (coinFlip == 1) { AddDataToSuitcase(ss, tempCorrect, true); } else { AddDataToSuitcase(ss, wrongAnswers, false); } } else if (tempCorrect.Count > 0) { AddDataToSuitcase(ss, tempCorrect, true); ss.isCorrectAnswer = true; } else if (wrongAnswers.Count > 0) { AddDataToSuitcase(ss, wrongAnswers, false); } } }
private void AddDataToSuitcase(ScannerSuitcase ss, List <ILivingLetterData> fromList, bool isCorrect) { var ans = fromList.RandomSelectOne(); ss.drawing.text = ans.DrawingCharForLivingLetter; ss.wordId = ans.Id; ss.isCorrectAnswer = isCorrect; fromList.Remove(ans); }
void matchLLToSS(ScannerLivingLetter targetLL) { currentLL = targetLL; foreach (ScannerSuitcase sc in game.suitcases) { if (targetLL.LLController.Data.Id == sc.wordId) { currentSuitcases = sc; source = sc.transform; target = targetLL.transform; break; } } }