// Update is called once per frame void CreatePlanet(int _seed) { // Create planet system GameObject planet_system = (GameObject)Instantiate(Resources.Load("PlanetSystem")); PlanetarySystem psc = planet_system.GetComponent(typeof(PlanetarySystem)) as PlanetarySystem; // Planet PlanetConfig p_config = new PlanetConfig(); // Name p_config.name = "p" + seed.ToString(); // Size p_config.diameter = Random.Range(p_limits.diameter_min_size, p_limits.diameter_max_size); p_config.size = ClassifySize(p_config.diameter); // Atmosphere p_config.temperature = Random.Range(p_limits.temperature_min, p_limits.temperature_max); p_config.humidity = Random.Range(p_limits.humidity_min, p_limits.humidity_max); // Classification (type) if (p_config.size >= PlanetConfig.SizeClassification.Large) { p_config.type = PlanetConfig.PlanetType.Gas; } else { p_config.type = PlanetConfig.PlanetType.Solid; } // Population (if planet solid) if (p_config.type == PlanetConfig.PlanetType.Solid) { p_config.has_civ = true; if (p_config.has_civ == true) { p_config.density = Random.Range(0.01f, p_limits.max_density); int max_pop = (int)((p_config.density * 1000) * 1.0 + (float)p_config.size) * 10000; int min_pop = (int)((p_config.density * 100) * 1.0 + (float)p_config.size) * 1000; p_config.population = Random.Range(min_pop, max_pop); } else { p_config.density = 0.0f; p_config.population = 0; } } else { p_config.has_civ = false; p_config.density = 0.0f; p_config.population = 0; } if (p_config.type == PlanetConfig.PlanetType.Solid) { // Clouds p_config.has_clouds = true; p_config.cloud_elevation = (4 - (float)p_config.size) / 5; p_config.cloud_coverage = Random.Range(0, 1.0f); } else { p_config.has_clouds = false; } // Set Meteorites SetResources(ref p_config); // Set Meteorites SetMeteorites(ref p_config); // Set nightlights color p_config.nightlights_col = new Color(0.8f, 0.6f, 0.1f); // Initiate planet psc.Initiate(_seed, p_config); // Update stats in GUI StatManager s_manager = GameObject.Find("UiUpdater").GetComponent(typeof(StatManager)) as StatManager; s_manager.SetStats(p_config); }