Beispiel #1
0
        /// <summary>
        /// Sets default settings for asteroids with unmodified orbits. The object is initialized
        /// to a state in which it will not be expected to generate orbits. Does not throw
        /// exceptions.
        /// </summary>
        internal DefaultAsteroids()
        {
            name      = "default";
            title     = Localizer.GetStringByTag("#autoLOC_6001923");
            spawnRate = 0.0;

            classRatios = new Proportions <string> (new [] { "1.0 PotatoRoid" });
        }
 /// <summary>
 /// Randomly selects an asteroid class. The selection is weighted by the proportions passed
 /// to the method.
 /// </summary>
 ///
 /// <param name="typeRatios">The proportions in which to select the types.</param>
 /// <returns>The selected asteroid class. Shall not be null.</returns>
 ///
 /// <exception cref="InvalidOperationException">Thrown if there are no types from
 /// which to choose, or if all proportions are zero, or if any proportion is
 /// negative.</exception>
 internal static string drawAsteroidType <Dummy> (Proportions <Dummy> typeRatios)
 {
     try {
         return(RandomDist.weightedSample(typeRatios.asPairList()));
     } catch (ArgumentException e) {
         throw new InvalidOperationException(
                   Localizer.Format("#autoLOC_CustomAsteroids_ErrorNoClass2"), e);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Creates a dummy population. The object is initialized to a state in which it will not
        /// be expected to generate orbits.
        /// <para>Does not throw exceptions.</para>
        /// </summary>
        internal AbstractAsteroidSet()
        {
            name      = "invalid";
            title     = Localizer.GetStringByTag("#autoLOC_6001923");
            spawnRate = 0.0;           // Safeguard: don't make asteroids until the values are set

            detectable = null;

            classRatios = new Proportions <string> (new [] { "1.0 PotatoRoid" });
        }
        /// <summary>
        /// Creates a dummy population. The object is initialized to a state in which it will not
        /// be expected to generate orbits.
        /// <para>Does not throw exceptions.</para>
        /// </summary>
        internal AbstractAsteroidSet()
        {
            name      = "invalid";
            title     = Localizer.GetStringByTag("#autoLOC_6001923");
            spawnRate = 0.0;           // Safeguard: don't make asteroids until the values are set
            spawnMax  = int.MaxValue;

            detectable = null;

            classRatios = new Proportions <string> (new [] { "1.0 PotatoRoid" });

            sizeRatios = null;

            orbitType    = "intermediate";
            useCometName = true;
        }