/// <summary> /// Генерирует галактику нерегулярного типа /// </summary> /// <param name="offset">Временной сдвиг</param> /// <param name="galaxysize">Размер галактики</param> /// <param name="starscount">Количество звезд</param> void generate_irregular_galaxy(double offset, int galaxysize, int starscount) { Double r; //radius Double t; //rotate angle Random rand = new Random(); r = 0; t = offset; for (int i = 0; i < starscount / 2; i++) { StarSystem s = new StarSystem(); r += rand.NextDouble() * galaxysize * 10; t += 0.2 - Math.PI * 2; s.timeOffset = t; s.R = r; s.y = -5.0 + rand.NextDouble() * 10.0; s.increment = rand.Next(-starscount * 100, starscount * 100); s.type = rand.Next(7); //type impact on size and color s.name = GenerateRandomStarName(); //s.name = (i + 1).ToString(); switch (s.type) { //O - Blue, t =30 000 — 60 000 K case 0: s.color = PlanetBrushes.BlueBrush; break; //B - Light blue, t = 10 500 — 30 000 K case 1: s.color = PlanetBrushes.LightBlueBrush; break; //A - White, t = 7500—10 000 K case 2: s.color = PlanetBrushes.WhiteBrush; break; //F - Light Yellow, t = 6000—7200 K case 3: s.color = PlanetBrushes.LightYellowBrush; break; //G - Yellow, t = 5500 — 6000 K case 4: s.color = PlanetBrushes.YellowBrush; break; //K - Orange, t = 4000 — 5250 K case 5: s.color = PlanetBrushes.OrangeBrush; break; //M - Red, t = 2600 — 3850 K case 6: s.color = PlanetBrushes.RedBrush; break; } Planet.generatePlanets(s, Time); stars.Add(s); } }
/// <summary> /// Генерирует элиптическую галактику /// </summary> /// <param name="galaxysize">Размер галактики</param> /// <param name="starscount">Количество звезд</param> void generate_elliptical_galaxy(int galaxysize, int starscount) { Random rand = new Random((int)DateTime.Now.Ticks); double inc = Math.PI * 48 / starscount; double t = 0, r = 100 * (galaxysize + 1); for (int i = 0; i < starscount; i++) { StarSystem s = new StarSystem(); t += inc + rand.NextDouble() * galaxysize; s.timeOffset = t; s.R = r + rand.Next(starscount) * 10; s.type = rand.Next(7); //type impact on size and color s.name = GenerateRandomStarName(); switch (s.type) { //O - Blue, t =30 000 — 60 000 K case 0: s.color = PlanetBrushes.BlueBrush; break; //B - Light blue, t = 10 500 — 30 000 K case 1: s.color = PlanetBrushes.LightBlueBrush; break; //A - White, t = 7500—10 000 K case 2: s.color = PlanetBrushes.WhiteBrush; break; //F - Light Yellow, t = 6000—7200 K case 3: s.color = PlanetBrushes.LightYellowBrush; break; //G - Yellow, t = 5500 — 6000 K case 4: s.color = PlanetBrushes.YellowBrush; break; //K - Orange, t = 4000 — 5250 K case 5: s.color = PlanetBrushes.OrangeBrush; break; //M - Red, t = 2600 — 3850 K case 6: s.color = PlanetBrushes.RedBrush; break; } Planet.generatePlanets(s, Time); stars.Add(s); } }
/// <summary> /// Генерирует сферическую галактику /// </summary> /// <param name="galaxysize">Размер галактики</param> /// <param name="starscount">Количество звезд</param> void generate_sphere_galaxy(int galaxysize, int starscount) { Double r; Double t = 0;; Random rand = new Random(); for (int j = 0; j < starscount / 2; j++) { r = 0; t += Math.PI * starscount / 2 + rand.NextDouble() * galaxysize; for (int i = 0; i < 2; i++) { r = rand.Next(starscount); StarSystem s = new StarSystem(); s.R = r; s.increment = 100 * (galaxysize + 1); s.timeOffset = t; s.type = rand.Next(7); //type impact on size and color s.name = GenerateRandomStarName(); switch (s.type) { //O - Blue, t =30 000 — 60 000 K case 0: s.color = PlanetBrushes.BlueBrush; break; //B - Light blue, t = 10 500 — 30 000 K case 1: s.color = PlanetBrushes.LightBlueBrush; break; //A - White, t = 7500—10 000 K case 2: s.color = PlanetBrushes.WhiteBrush; break; //F - Light Yellow, t = 6000—7200 K case 3: s.color = PlanetBrushes.LightYellowBrush; break; //G - Yellow, t = 5500 — 6000 K case 4: s.color = PlanetBrushes.YellowBrush; break; //K - Orange, t = 4000 — 5250 K case 5: s.color = PlanetBrushes.OrangeBrush; break; //M - Red, t = 2600 — 3850 K case 6: s.color = PlanetBrushes.RedBrush; break; } Planet.generatePlanets(s, Time); stars.Add(s); } } }
void ShowPlanet(Planet p) { Text = "Планета " + p.name; string sizeText = ""; string mineralsText = ""; string climateText = ""; //ниже- определение размера планеты if (p.SIZE < 15) { sizeText = "Small"; } else if ((p.SIZE >= 15) && (p.SIZE < 23)) { sizeText = "Medium"; } else if ((p.SIZE >= 23) && (p.SIZE < 30)) { sizeText = "Big"; } else if (p.SIZE >= 30) { sizeText = "Extra"; } switch (p.MINERALS) { case 0: mineralsText = "Very Small"; break; case 1: mineralsText = "Small"; break; case 2: mineralsText = "Medium"; break; case 3: mineralsText = "Large"; break; case 4: mineralsText = "Extra"; break; } //ниже - определение климата switch (p.CLIMATE) { case 0: climateText = "Без атмосферы"; break; case 1: climateText = "Лава"; break; case 2: climateText = "Тундра"; break; case 3: climateText = "Умеренный"; break; case 4: climateText = "Идеальный"; break; default: MessageBox.Show("Error occured with climat number(" + p.CLIMATE + ")"); break; } sizeLabel.Text = "Размер: " + sizeText; mineralsLabel.Text = "Минералы: " + mineralsText; populationLabel.Text = "Популяция: " + Math.Round(p.POPULATION, 3) + "млн./" + Math.Round(p.POPULATIONMAX, 3) + "млн."; profitLabel.Text = "Прирост кредитов : " + Math.Round(p.PROFIT, 3) + " $"; ownerLabel.Text = "Владелец: " + starSystem.Owner.name; climateLabel.Text = "Климат: " + climateText; skillPointLabel.Text = "Прирост очков изучения: " + p.skillPointProduce; buildingsTextBox.Text = ""; //set buildings textbox to empty string for (int z = 0; z < Player.buildings.Count; z++) //chech all player builds { if (Player.buildings[z][0] == Form1.Game.Player.stars.IndexOf(Form1.Game.Player.selectedStar) && //check current starsystem Player.buildings[z][1] == planet_selected) //check current planet { //if ok add builds to text box buildingsTextBox.AppendText(Buildings.buildings[Player.buildings[z][2]] + "\n"); } } }