private void fallbackRandom() { Debug.LogWarning("No possible combinations found. Fell Back to random Generation."); _failSaveCounter = 0; _numberTypeFront = FMC_Settings.numberType.mixed; _numberTypeBack = FMC_Settings.numberType.mixed; if (!_allreadyFellBackToRandom) { findCurrentMethod(); } else { Debug.LogWarning("Fell back to complete random generation. This is not great."); _operation = FMC_Task.operations.plus; x = Random.Range(1, _rangeOfNumbers); y = Random.Range(1, _rangeOfNumbers); } _allreadyFellBackToRandom = true; }
private void findMethod() { currentMethodId = ""; // Operation List <string> possibleOperations = new List <string>(); if (currentSetting._operationPlusIsPossible) { possibleOperations.Add("Plus"); } if (currentSetting._operationTimesIsPossible) { possibleOperations.Add("Times"); } if (currentSetting._operationMinusIsPossible) { possibleOperations.Add("Minus"); } if (currentSetting._operationDividedIsPossible) { possibleOperations.Add("Divided"); } if (possibleOperations.Count == 0) { possibleOperations.Add("Plus"); Debug.LogWarning("Operation nicht richtig eingestellt."); } string chosenOperation = possibleOperations[Random.Range(0, possibleOperations.Count)]; currentMethodId += chosenOperation; if (chosenOperation == "Plus") { _operation = FMC_Task.operations.plus; } else if (chosenOperation == "Times") { _operation = FMC_Task.operations.times; } else if (chosenOperation == "Minus") { _operation = FMC_Task.operations.minus; } else { _operation = FMC_Task.operations.divided; } // Task Type List <string> possibleTaskTypes = new List <string>(); if (currentSetting._taskTypeGreaterIsPossible) { possibleTaskTypes.Add("FrontIsGreater"); } if (currentSetting._taskTypeSameIsPossible) { possibleTaskTypes.Add("Same"); } if (currentSetting._taskTypeSmallerIsPossible) { possibleTaskTypes.Add("FrontIsSmaller"); } if (currentSetting._taskTypeEqualsIsPossible) { Debug.LogWarning("Task Type == Ergibt Zahlenraum existiert nicht mehr."); } if (currentSetting._taskTypeOneTimesOneIsPossible) { oneTimesOne(); _taskType = FMC_Task.taskTypes.oneTimesOne; return; } if (possibleTaskTypes.Count == 0) { possibleTaskTypes.Add("FrontIsGreater"); Debug.LogWarning("TaskType nicht richtig eingestellt."); } int index = Random.Range(0, possibleTaskTypes.Count); string chosenTaskType = possibleTaskTypes[index]; if (chosenTaskType == "Same" && possibleTaskTypes.Count > 1 && Random.Range(1, 11) < 7) { possibleTaskTypes.RemoveAt(index); chosenTaskType = possibleTaskTypes[Random.Range(0, possibleTaskTypes.Count)]; } currentMethodId += chosenTaskType; if (chosenTaskType == "FrontIsGreater") { _taskType = FMC_Task.taskTypes.greater; } else if (chosenTaskType == "Same") { _taskType = FMC_Task.taskTypes.same; } else { _taskType = FMC_Task.taskTypes.smaller; } findCurrentMethod(); }