public static StarSystem GenerateSystem(int width, int height)
        {
            //Get type of star
            int maxNum      = Enum.GetNames(typeof(Types.StarType)).Length;
            int starTypeNum = Randomizer.GetRandomNumber(0, maxNum - 1);

            Types.StarType starType = (Types.StarType)starTypeNum;

            string starColor  = "yellow";
            float  solarMass  = 1.0F;
            float  solarSize  = 1.0F;
            float  solarLum   = 1.0F;
            int    numPlanets = 0;
            string starName   = "G";

            //Create randomized characteristics based on star type
            switch (starType)
            {
            case Types.StarType.ClassO:
                starName  = "O";
                starColor = "blue";
                solarMass = (float)Randomizer.GetRandomNumber(16, 50);
                solarSize = ((float)Randomizer.GetRandomNumber(66, 100)) / 10;
                solarLum  = (float)Randomizer.GetRandomNumber(30000, 50000);
                break;

            case Types.StarType.ClassB:
                starName  = "B";
                starColor = "blue-white";
                solarMass = ((float)Randomizer.GetRandomNumber(21, 160)) / 10;
                solarSize = ((float)Randomizer.GetRandomNumber(18, 66)) / 10;
                solarLum  = (float)Randomizer.GetRandomNumber(25, 30000);
                break;

            case Types.StarType.ClassA:
                starName  = "A";
                starColor = "white";
                solarMass = ((float)Randomizer.GetRandomNumber(140, 210)) / 100;
                solarSize = ((float)Randomizer.GetRandomNumber(140, 180)) / 100;
                solarLum  = ((float)Randomizer.GetRandomNumber(50, 250)) / 10;
                break;

            case Types.StarType.ClassF:
                starName  = "F";
                starColor = "yellow-white";
                solarMass = ((float)Randomizer.GetRandomNumber(104, 140)) / 100;
                solarSize = ((float)Randomizer.GetRandomNumber(115, 140)) / 100;
                solarLum  = ((float)Randomizer.GetRandomNumber(150, 500)) / 100;
                break;

            case Types.StarType.ClassG:
                starName  = "G";
                starColor = "yellow";
                solarMass = ((float)Randomizer.GetRandomNumber(80, 104)) / 100;
                solarSize = ((float)Randomizer.GetRandomNumber(96, 115)) / 100;
                solarLum  = ((float)Randomizer.GetRandomNumber(60, 150)) / 100;
                break;

            case Types.StarType.ClassK:
                starName  = "K";
                starColor = "orange";
                solarMass = ((float)Randomizer.GetRandomNumber(45, 80)) / 100;
                solarSize = ((float)Randomizer.GetRandomNumber(70, 96)) / 100;
                solarLum  = ((float)Randomizer.GetRandomNumber(8, 60)) / 100;
                break;

            case Types.StarType.ClassM:
                starName  = "M";
                starColor = "red";
                solarMass = ((float)Randomizer.GetRandomNumber(8, 45)) / 100;
                solarSize = ((float)Randomizer.GetRandomNumber(1, 70)) / 100;
                solarLum  = ((float)Randomizer.GetRandomNumber(1, 8)) / 100;
                break;
            }

            //Create randomized name
            int classNumber  = Randomizer.GetRandomNumber(0, 9);
            int randomNumber = Randomizer.GetRandomNumber(1, 99);
            int greekLetter  = Randomizer.GetRandomNumber(0, Types.GreekLetters.Length);

            starName = Types.GreekLetters[greekLetter] + " " + randomNumber.ToString() +
                       "-" + starName + classNumber.ToString();


            //Create planets
            numPlanets = Randomizer.GetRandomNumber(0, 7);

            //Set coordinates
            int x = Randomizer.GetRandomNumber(0, width);
            int y = Randomizer.GetRandomNumber(0, height);

            StarSystem newSystem = new StarSystem(starColor, solarMass, solarSize, solarLum, numPlanets, starName, starType, x, y);

            List <Planet> listOfPlanets = GeneratePlanets(newSystem, numPlanets);

            newSystem.PopulatePlanets(listOfPlanets);
            newSystem.PrimaryRingPlanet = ChoosePrimaryRingPlanet(listOfPlanets);

            newSystem.Searched = false;

            int discovered = Randomizer.GetRandomNumber(0, 2);

            if (discovered == 0)
            {
                newSystem.Discovered = false;
            }
            else
            {
                newSystem.Discovered = true;
            }

            return(newSystem);
        }
        public static StarSystem CreateSol(int galWidth, int galHeight)
        {
            StarSystem sol = new StarSystem("yellow", 1.0f, 1.0f, 1.0f, 9, "Sol", Types.StarType.ClassG, galWidth / 2, galHeight / 2);

            sol.Discovered = true;
            sol.Searched   = true;

            sol.planets = new List <Planet>(9);
            Planet newP;

            //Mercury
            newP       = new Planet(Types.PlanetSize.SEClass, Types.PlanetComp.Solid, Types.Atmosphere.None, Types.Climate.Arid, Types.EmLevel.High, 60, 1, 0, "Mercury", sol, Color.Red);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Venus
            newP       = new Planet(Types.PlanetSize.EClass, Types.PlanetComp.MoltenCore, Types.Atmosphere.CarbonDioxide, Types.Climate.Humid, Types.EmLevel.Medium, 105, 2, 0, "Venus", sol, Color.Yellow);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Earth
            newP       = new Planet(Types.PlanetSize.EClass, Types.PlanetComp.MoltenCore, Types.Atmosphere.OxygenNitrogen, Types.Climate.Temperate, Types.EmLevel.Low, 150, 3, 1, "Earth", sol, Color.Blue);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Grassland, new List <Resource>(), newP));
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.zones.Add(new PlanetZone(Types.Biome.Tundra, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Mars
            newP       = new Planet(Types.PlanetSize.SEClass, Types.PlanetComp.Solid, Types.Atmosphere.Minor, Types.Climate.Arid, Types.EmLevel.High, 228, 4, 2, "Mars", sol, Color.Red);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched         = true;
            newP.HasMainRing      = true;
            newP.ringZone         = newP.zones[0];
            sol.PrimaryRingPlanet = newP;
            sol.planets.Add(newP);
            //Jupiter
            newP       = new Planet(Types.PlanetSize.JClass, Types.PlanetComp.Gas, Types.Atmosphere.HydrogenHelium, Types.Climate.Storm, Types.EmLevel.High, 779, 5, 67, "Jupiter", sol, Color.Purple);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Saturn
            newP       = new Planet(Types.PlanetSize.JClass, Types.PlanetComp.Gas, Types.Atmosphere.HydrogenHelium, Types.Climate.Storm, Types.EmLevel.High, 1434, 6, 62, "Saturn", sol, Color.Orange);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Uranus
            newP       = new Planet(Types.PlanetSize.NClass, Types.PlanetComp.Gas, Types.Atmosphere.HydrogenHelium, Types.Climate.Storm, Types.EmLevel.Medium, 2873, 7, 27, "Uranus", sol, Color.MediumBlue);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Neptune
            newP       = new Planet(Types.PlanetSize.NClass, Types.PlanetComp.Gas, Types.Atmosphere.HydrogenHelium, Types.Climate.Storm, Types.EmLevel.Medium, 4495, 8, 14, "Neptune", sol, Color.Turquoise);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);
            //Pluto
            newP       = new Planet(Types.PlanetSize.DwarfPlanet, Types.PlanetComp.RockIce, Types.Atmosphere.None, Types.Climate.Arid, Types.EmLevel.Low, 5906, 9, 5, "Pluto", sol, Color.Gray);
            newP.zones = new List <PlanetZone>();
            newP.zones.Add(new PlanetZone(Types.Biome.Desert, new List <Resource>(), newP));
            newP.Searched = true;
            sol.planets.Add(newP);

            return(sol);
        }
Esempio n. 3
0
        public Planet(Types.PlanetSize planetSize, Types.PlanetComp planetComp, Types.Atmosphere planetAtmos, Types.Climate planetClim, Types.EmLevel planetEM,
                      int orbitSize, int orbitNum, int numberOfMoons, string planetName, StarSystem currentSystem, Color planetColor)
        {
            size       = planetSize;
            atmosphere = planetAtmos;
            comp       = planetComp;
            climate    = planetClim;
            emLevel    = planetEM;

            orbitalRadius = orbitSize;
            orbitalNum    = orbitNum;
            numMoons      = numberOfMoons;
            name          = planetName;
            system        = currentSystem;

            color           = planetColor;
            searched        = false;
            hasGalacticRing = false;

            //Zones need to be added later
        }