Beispiel #1
0
        public static IEnumerable <Kerberos.Sots.Data.StarMapFramework.Orbit> ChooseOrbitContents(
            Random random,
            StellarClass stellarClass)
        {
            Range <int> orbits            = StarHelper.ChooseOrbits(random, stellarClass);
            int         asteroidBeltCount = 0;

            for (int orbitNumber = 1; orbitNumber <= orbits.Max; ++orbitNumber)
            {
                OrbitContents orbitContents = OrbitContents.Empty;
                if (orbitNumber >= orbits.Min)
                {
                    bool flag = false;
                    while (!flag)
                    {
                        flag          = true;
                        orbitContents = WeightedChoices.Choose <OrbitContents>((double)StarHelper.CalcOrbitContentRoll(random, orbitNumber), StarHelper.OrbitContentWeights);
                        if (orbitContents == OrbitContents.AsteroidBelt && asteroidBeltCount >= 2)
                        {
                            flag = false;
                        }
                    }
                }
                if (orbitContents == OrbitContents.AsteroidBelt)
                {
                    ++asteroidBeltCount;
                }
                Kerberos.Sots.Data.StarMapFramework.Orbit orbiter = StarSystemHelper.CreateOrbiterParams(orbitContents);
                orbiter.OrbitNumber = orbitNumber;
                yield return(orbiter);
            }
        }
Beispiel #2
0
        public static IEnumerable <Kerberos.Sots.Data.StarMapFramework.Orbit> ChooseOrbitContents(
            Random random)
        {
            Orbits orbits = WeightedChoices.Choose <Orbits>(random.NextDouble(), GasGiantHelper.OrbitCountWeights);
            int    count  = StarSystemHelper.GetOrbitCount(orbits);

            if (count >= 0)
            {
                for (int orbitNumber = 1; orbitNumber <= count; ++orbitNumber)
                {
                    OrbitContents chosenContents = WeightedChoices.Choose <OrbitContents>(random.NextDouble(), GasGiantHelper.OrbitContentWeights);
                    Kerberos.Sots.Data.StarMapFramework.Orbit orbiter = StarSystemHelper.CreateOrbiterParams(chosenContents);
                    orbiter.OrbitNumber = orbitNumber;
                    yield return(orbiter);
                }
            }
            else if (orbits == Orbits.Ring)
            {
                int ringOrbitNumber = 1;
                Kerberos.Sots.Data.StarMapFramework.Orbit orbiter = StarSystemHelper.CreateOrbiterParams(OrbitContents.PlanetaryRing);
                orbiter.OrbitNumber = ringOrbitNumber;
                yield return(orbiter);
            }
        }