public void Next() { int safetyCount = 0; scenarioId++; while (true) { if (scenarioId > ScenarioRepository.Count) { break; } Scenario scenario = ScenarioRepository.FindById(scenarioId); if (Regex.IsMatch(scenario.Command, @"^\*") || Regex.IsMatch(scenario.Command, @"^\/\/")) { scenarioId++; continue; } if (CommandFunc(scenario)) { break; } safetyCount++; if (safetyCount > 1000) { Debug.LogWarning("INFINIT LOOP"); break; } } }
public void OnSelectionSelected(int index) { scenarioId += index; JumpTo(ScenarioRepository.FindById(scenarioId).Arg1); Next(); }