// Token: 0x06002161 RID: 8545 public IEnumerator Generate() { ScreenFader.Get().SetBlack(); Singleton <InputManager> .Instance.ChangeInput(false, false, false); while (Singleton <CarBundleLoader> .Instance) { if (Singleton <CarBundleLoader> .Instance.IsReady) { IL_BE: while (Localization.Instance) { if (Localization.Instance.IsReady) { IL_E7: while (Singleton <GameInventory> .Instance && !Singleton <GameInventory> .Instance.IsReady) { yield return(new WaitForEndOfFrame()); } GlobalData.Load(); base.StartCoroutine(UIManager.Get().RefreshStatsUI("Money")); base.StartCoroutine(UIManager.Get().RefreshStatsUI("Experience")); base.StartCoroutine(UIManager.Get().RefreshStatsUI("Orders")); base.StartCoroutine(UIManager.Get().RefreshStatsUI("Level")); Singleton <RichPresenceManager> .Instance.SendPresence("console_richtxt_junk"); Singleton <TempInventory> .Instance.CleanListOfItems(); GameManager.CanMount = false; GameManager.CanUnmount = false; base.StartCoroutine(UIManager.Get().cleanElement("CanvasInventory/Inventory/Content/ScrollRect/Content")); UnityEngine.Random.Range(this.CarsPercentage.x, this.CarsPercentage.y); float amount = 24f; List <Transform> carSpawnPositions = this.CarSpawnPositions.ToList <Transform>(); Debug.Log("Spawn " + amount + " cars"); yield return(new WaitForEndOfFrame()); int num = 0; while ((float)num < amount) { int index = UnityEngine.Random.Range(0, carSpawnPositions.Count); base.StartCoroutine(this.CreateCar(carSpawnPositions[index])); carSpawnPositions.RemoveAt(index); num++; } InteractiveObject[] ios = this.Junkyard.GetComponentsInChildren <InteractiveObject>(); float percentItems = UnityEngine.Random.Range(this.ItemsPercentage.x, this.ItemsPercentage.y); List <InteractiveObject> items = ios.ToList <InteractiveObject>(); float amountItems = Mathf.Floor(percentItems / 100f * (float)items.Count((InteractiveObject x) => x.GetSpecialType() == IOSpecialType.Junk)); List <InteractiveObject> listOfSelectedJunks = new List <InteractiveObject>(); Debug.Log("Enable " + amountItems); yield return(new WaitForEndOfFrame()); int num2 = 0; while ((float)num2 < amountItems) { int index2 = UnityEngine.Random.Range(0, items.Count); InteractiveObject interactiveObject = items[index2]; interactiveObject.enabled = true; if (interactiveObject.GetSpecialType() == IOSpecialType.Junk) { interactiveObject.gameObject.AddComponent <Junk>().AddRandomItems(this.rangeJunkCondition.x, this.rangeJunkCondition.y); listOfSelectedJunks.Add(interactiveObject); items.RemoveAt(index2); } else { num2--; } num2++; } if (Singleton <DifficultyManager> .Instance.GetDifficultyLevel() != DifficultyLevel.Sandbox) { listOfSelectedJunks.ElementAt(UnityEngine.Random.Range(0, listOfSelectedJunks.Count)).GetComponent <Junk>().AddSpecialMap(); } yield return(new WaitForEndOfFrame()); GameScript.Get().ReloadCarsOnScene(); Singleton <DifficultyManager> .Instance.ActivateDifficultyLevel(); UIManager.Get().PrepareTempInventory(); SceneLoader.BlockProgress = false; GameManager.IsGameReady = true; yield return(new WaitForEndOfFrame()); if (this.shortPauseWhileFade) { yield return(new WaitForSeconds(5f)); } GameMode.Get().SetCurrentMode(gameMode.Garage); yield return(new WaitForSeconds(1f)); ScreenFader.Get().NormalFadeOut(); while (ScreenFader.Get().IsRunning()) { yield return(new WaitForEndOfFrame()); } Singleton <InputManager> .Instance.ChangeInput(true, true, false); yield break; } yield return(new WaitForEndOfFrame()); } goto IL_E7; } yield return(new WaitForEndOfFrame()); } goto IL_BE; }