Ejemplo n.º 1
0
        /// <summary>
        /// Генерирует колекцию <see cref="Star"/> системы
        /// </summary>
        /// <param name="name">
        /// Имя звездной системы, в которой находятся генерируемые звезды
        /// </param>
        /// <returns>
        /// <see cref="List{T}"/>, содержащий <see cref="Star"/>
        /// </returns>
        private static List <Star> GenerateSystemStars(string name)
        {
            List <Star> stars            = new List <Star>();
            int         starsCount       = 0;
            int         probabilityIndex = HelperRandomFunctions.GetRandomInt(1, maxPercents + 1);

            if (probabilityIndex < 70)
            {
                starsCount = 1;
            }
            else if (probabilityIndex < 100)
            {
                starsCount = 2;
            }
            else
            {
                starsCount = 3;
            }

            for (int index = 0; index < starsCount; index++)
            {
                stars.Add(StarFactory.GenerateStar($"{name} Star #{index + 1}"));
            }

            return(stars);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Генерирует газовые планеты системы
        /// </summary>
        /// <param name="systemName">
        /// Имя звездной системы, в которой находятся генерируемые планеты
        /// </param>
        /// <param name="planetCount">
        /// Счетчик планет системы
        /// </param>
        private static List <Planet> GetGasGiantPlanets(string systemName, ref int planetCount)
        {
            int           gasGiantCount = HelperRandomFunctions.GetRandomInt(minGasGiantCount, maxGasGiantCount + 1);
            List <Planet> planets       = new List <Planet>();

            for (int index = 0; index < gasGiantCount; index++)
            {
                planets.Add(PlanetFactory.GetPlanet(GetPlanetName(systemName, planetCount),
                                                    new PlanetType(TemperatureClass.Cold, VolatilesClass.Airless, SubstancesClass.Jupiter)));
                planetCount++;
            }

            return(planets);
        }
Ejemplo n.º 3
0
        private static IList <StarSystem> DiscoverNewStarSystem(int discoveredSystemsCount)
        {
            IList <StarSystem> generatedSystems = new List <StarSystem>();

            int maxSystemsToGenerate = (int)(Math.Sqrt(discoveredSystemsCount));
            int systemsToGenerate    = HelperRandomFunctions.GetRandomInt(1, maxSystemsToGenerate + 1);

            for (int index = 0; index < systemsToGenerate; index++)
            {
                StarSystem generatedSystem =
                    StarSystemFactory.GetStarSystem($"System {discoveredSystemsCount + 1} #{index}");

                generatedSystems.Add(generatedSystem);
            }

            return(generatedSystems);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Генерирует безжизненные планеты системы
        /// </summary>
        /// <param name="nameTemplate">
        /// Имя звездной системы, в которой находятся генерируемые планеты
        /// </param>
        /// <param name="planetCount">
        /// Счетчик планет системы
        /// </param>
        /// <param name="stars">
        /// Коллекция <see cref="Star"/> системы
        /// </param>
        private static List <Planet> GetBarrenPlanets(string systemName, ref int planetCount, List <Star> stars)
        {
            int barrenCount = HelperRandomFunctions.GetRandomInt(minBarrenCount, maxBarrenCount + 1);

            LuminosityClass systemStarClass = stars[0].LumClass;
            List <Planet>   planets         = new List <Planet>();

            TemperatureClass planetTemperature;

            if (systemStarClass == LuminosityClass.M ||
                systemStarClass == LuminosityClass.K)
            {
                planetTemperature = TemperatureClass.Warm;
            }
            else
            {
                planetTemperature = TemperatureClass.Hot;
            }

            if (HelperRandomFunctions.PercentProbableBool(20) && barrenCount >= 1)
            {
                planets.Add(PlanetFactory.GetPlanet(GetPlanetName(systemName, planetCount),
                                                    new PlanetType(planetTemperature, VolatilesClass.Airless, SubstancesClass.Ferria)));

                planetCount++;
                barrenCount--;

                if (HelperRandomFunctions.PercentProbableBool(20) && barrenCount >= 1)
                {
                    planets.Add(PlanetFactory.GetPlanet(GetPlanetName(systemName, planetCount),
                                                        new PlanetType(planetTemperature, VolatilesClass.Airless, SubstancesClass.Ferria)));

                    planetCount++;
                    barrenCount--;
                }
            }

            for (int index = 0; index < barrenCount; index++)
            {
                planets.Add(PlanetFactory.GetPlanet(GetPlanetName(systemName, planetCount),
                                                    new PlanetType(planetTemperature, VolatilesClass.Airless, SubstancesClass.Terra)));
                planetCount++;
            }

            return(planets);
        }
Ejemplo n.º 5
0
        private static double GasGiantRadiusGeneration()
        {
            double radius;

            if (HelperRandomFunctions.PercentProbableBool(10))
            {
                radius = (double)HelperRandomFunctions.GetRandomInt(bigGasPlanetMinRadius, bigGasPlanetMaxRadius);
            }
            else if (HelperRandomFunctions.PercentProbableBool(20))
            {
                radius = (double)HelperRandomFunctions.GetRandomInt(mediumGasPlanetMinRadius, bigGasPlanetMinRadius);
            }
            else
            {
                radius = (double)HelperRandomFunctions.GetRandomInt(smallGasPlanetMinRadius, mediumGasPlanetMinRadius);
            }
            return(radius);
        }
Ejemplo n.º 6
0
        private static double RockyPlanetRadiusGeneration()
        {
            double radius;

            if (HelperRandomFunctions.PercentProbableBool(8))
            {
                radius = (double)HelperRandomFunctions.GetRandomInt(bigPlanetMinRadius, bigPlanetMaxRadius);
            }
            else if (HelperRandomFunctions.PercentProbableBool(15))
            {
                radius = (double)HelperRandomFunctions.GetRandomInt(mediumPlanetMinRadius, bigPlanetMinRadius);
            }
            else
            {
                radius = (double)HelperRandomFunctions.GetRandomInt(smallPlanetMinRadius, mediumPlanetMinRadius);
            }

            return(radius);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Генерирует обитаемые планеты системы
        /// </summary>
        /// <param name="systemName">
        /// Имя звездной системы, в которой находятся генерируемые планеты
        /// </param>
        /// <param name="planetCount">
        /// Счетчик планет системы
        /// </param>
        /// <param name="stars">
        /// Коллекция <see cref="Star"/> системы
        /// </param>
        private static List <Planet> GetHabitablePlanets(string systemName, ref int planetCount, List <Star> stars)
        {
            LuminosityClass systemStarClass = stars[0].LumClass;
            List <Planet>   planets         = new List <Planet>();

            if (systemStarClass == LuminosityClass.G ||
                systemStarClass == LuminosityClass.K ||
                systemStarClass == LuminosityClass.F)
            {
                int habitablePlanetCount = HelperRandomFunctions.GetRandomInt(minHabitableCount, maxHabitableCount + 1);
                for (int index = 0; index < habitablePlanetCount; index++)
                {
                    planets.Add(GetHabitablePlanet(GetPlanetName(systemName, planetCount), planetCount, systemStarClass));
                    planetCount++;
                }
            }

            return(planets);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Генерирует одну обитаемую планету
        /// </summary>
        /// <param name="systemName">
        /// Имя звездной системы, в которой находятся генерируемые планеты
        /// </param>
        private static HabitablePlanet GetHabitablePlanet(string planetName, int planetCount, LuminosityClass mainStarClass)
        {
            int probabilityIndex = HelperRandomFunctions.GetRandomInt(1, maxPercents + 1);

            PlanetType planetType;

            if (probabilityIndex >= 80)
            {
                planetType = new PlanetType(TemperatureClass.Temperate, VolatilesClass.Marine, SubstancesClass.Terra);
            }
            else if (probabilityIndex >= 60)
            {
                planetType = new PlanetType(TemperatureClass.Cool, VolatilesClass.Marine, SubstancesClass.Terra);
            }
            else
            {
                planetType = new PlanetType(TemperatureClass.Cool, VolatilesClass.Desertic, SubstancesClass.Terra);
            }

            return(PlanetFactory.GetHabitablePlanet(planetName, planetType));
        }