private IEnumerator LoadGame(int[] size) { yield return(null); var biomeConfig = ConfigImporter.GetAllConfigs <BiomeConfiguration>("World/Biomes").First(); var treeManager = new TreeManager(); yield return(treeManager.GenerateTrees((int)(size[0] * size[1] * 0.003f), Map.Instance.MapData, null)); AmbientManager.SpawnAmbientPlants(biomeConfig); //Map.Instance.transform.parent.transform.localScale = Vector3.one * 0.05f; }
IEnumerator LoadGame() { Time.timeScale = 0; yield return(null); _loadingScreen = FindObjectOfType <LoadingScreen>(); _loadingScreen.IsVisible.Value = true; //Load Materials SetStatus("Loading Materials", 0.01f); yield return(null); MaterialRegistry.Instance.Preload(); yield return(null); //Load Map SetStatus("Loading Map", 0.02f); yield return(null); var biomeConfig = ConfigImporter.GetAllConfigs <BiomeConfiguration>("World/Biomes").First(); yield return(Map.Instance.CreateMap(biomeConfig, this)); //Trees SetStatus("Loading Tree of Life", 0.8f); yield return(null); var treeManager = new TreeManager(); //treeManager.BuildTreeOfLife(); SetStatus("Loading Trees", 0.85f); yield return(null); yield return(treeManager.GenerateTrees((int)(Map.Instance.MapData.Chunks.GetLength(0) * Map.Instance.MapData.Chunks.GetLength(0) * 0.3f), Map.Instance.MapData, this)); //Ressources SetStatus("Loading Ressources", 0.95f); yield return(null); var resourceManager = new ResourceManager(); resourceManager.SpawnAllResources(Map.Instance.MapData, biomeConfig.OreConfiguration); yield return(null); //Characters SetStatus("Loading Characters", 0.96f); yield return(null); for (int i = 0; i < 5; i++) { UnitManager.SpawnUnitAtRandomPosition(Bunny); } //AmbientPlants SetStatus("Loading Ambient Plants", 0.97f); yield return(null); AmbientManager.SpawnAmbientPlants(biomeConfig); //AddT1Nodes SetStatus("Finish Pathfinder", 0.98f); yield return(null); Map.Instance.AStarNetwork.AddTier1Nodes(20); SetStatus("Done", 1f); //Start Time Again Time.timeScale = 1; yield return(null); GameLoaded = true; _loadingScreen.IsVisible.Value = false; SetCameraValues(); }