public static void GenerateRandomPlanet(StarProperties starProperties) { starProperties.planetType = GetRandomPlanetType(starProperties.color); CreatePlanetType(starProperties.planetType, starProperties); AddRandomModifiers(starProperties.planetType, starProperties); Debug.Log("Planet type: " + starProperties.planetType + " max pop: " + starProperties.maxPopulation); }
public void InitAndGenerate(InfoPaneManager infoPane, StarColor color, bool isHomeworld, uint id, Owners owner = Owners.NONE) { starProperties = new StarProperties(color, isHomeworld, owner); spendingInfo = new StarSpending(); // Init spending info. spendingInfo.population = starProperties.population; spendingInfo.factories = starProperties.factories; spendingInfo.waste = starProperties.waste; spendingInfo.reserves = starProperties.reserves; spendingInfo.maxPopulation = starProperties.maxPopulation; spendingInfo.effectiveMaxPopulation = starProperties.effectiveMaxPopulation; spendingInfo.reserves = starProperties.reserves; spendingInfo.Init(); ButtonManager.NextTurn += Turn; InfoPane = infoPane; }
private static void AddRandomModifiers(PlanetTypes type, StarProperties starProperties) { }
private static void CreatePlanetType(PlanetTypes type, StarProperties starProperties) { RandomWeight <int> popGenerator = new RandomWeight <int>(); switch (type) { case PlanetTypes.TERRAN: popGenerator.AddWeight(100, 4); popGenerator.AddWeight(90, 2); popGenerator.AddWeight(80, 2); popGenerator.AddWeight(70, 1); break; case PlanetTypes.DESERT: popGenerator.AddWeight(60, 2); popGenerator.AddWeight(50, 2); popGenerator.AddWeight(40, 2); popGenerator.AddWeight(30, 1); break; case PlanetTypes.OCEAN: popGenerator.AddWeight(100, 1); popGenerator.AddWeight(90, 2); popGenerator.AddWeight(80, 3); popGenerator.AddWeight(70, 3); break; case PlanetTypes.ARID: popGenerator.AddWeight(90, 1); popGenerator.AddWeight(80, 2); popGenerator.AddWeight(70, 3); popGenerator.AddWeight(60, 2); popGenerator.AddWeight(50, 1); break; case PlanetTypes.STEPPE: popGenerator.AddWeight(60, 2); popGenerator.AddWeight(50, 3); popGenerator.AddWeight(40, 2); popGenerator.AddWeight(30, 1); break; case PlanetTypes.JUNGLE: popGenerator.AddWeight(100, 1); popGenerator.AddWeight(90, 3); popGenerator.AddWeight(80, 3); popGenerator.AddWeight(70, 2); break; case PlanetTypes.BARREN: popGenerator.AddWeight(50, 3); popGenerator.AddWeight(40, 3); popGenerator.AddWeight(30, 2); popGenerator.AddWeight(20, 1); break; case PlanetTypes.TUNDRA: popGenerator.AddWeight(50, 1); popGenerator.AddWeight(40, 2); popGenerator.AddWeight(30, 3); popGenerator.AddWeight(20, 1); break; case PlanetTypes.INFERNO: popGenerator.AddWeight(50, 1); popGenerator.AddWeight(40, 1); popGenerator.AddWeight(30, 2); popGenerator.AddWeight(20, 2); break; case PlanetTypes.DEAD: popGenerator.AddWeight(50, 1); popGenerator.AddWeight(40, 3); popGenerator.AddWeight(30, 2); popGenerator.AddWeight(20, 1); break; case PlanetTypes.RADIATED: popGenerator.AddWeight(40, 2); popGenerator.AddWeight(30, 1); popGenerator.AddWeight(20, 2); popGenerator.AddWeight(10, 2); break; case PlanetTypes.TOXIC: popGenerator.AddWeight(40, 2); popGenerator.AddWeight(30, 2); popGenerator.AddWeight(20, 2); popGenerator.AddWeight(10, 1); break; } starProperties.maxPopulation = popGenerator.GetRandomKey(); }