public void AssignArchetype(PlanetArchetype archetype) { ArchetypeName = archetype.archetypeName; TotalSouls = archetype.GetRandomPopulation(); CurrentSouls = TotalSouls; CompletionCreditsBonus = archetype.completionCreditsBonus; this.gameObject.name = "Planet_" + ArchetypeName; }
// generate new planet shell public static PlanetData GeneratePlanet() { Object[] objs = Resources.LoadAll("Planets"); int randomPlanetArchetype = Random.Range(0, objs.Length); PlanetArchetype planetType = objs[randomPlanetArchetype] as PlanetArchetype; PlanetData data = new PlanetData(); data.size = Random.Range(PlanetData.minPlanetSize, PlanetData.maxPlanetSize); data.orbitRadius = Random.Range(PlanetData.minOrbitRadius, PlanetData.maxOrbitRadius); data.obstacleCount = Random.Range(planetType.obstacleCountBounds[0], planetType.obstacleCountBounds[1]); return(data); }