コード例 #1
0
        /// <summary>Generates a new natural satellite orbiting the body and adds it to the body's list of children.</summary>
        protected void AddSatellite()
        {
            var satellite = NewSatellite(Children.Count.ToString());

            if (!(satellite.Orbit.SemiMajorAxis < SphereOfInfluence))
            {
                return;
            }
            Children.Add(satellite);
            ChildrenDict.Add(satellite.Name, satellite);
        }
コード例 #2
0
        /// <summary>Generates a number of new natural satellites orbiting the body and adds them to the body's list of children.</summary>
        /// <param name="maxCount">The upper bound on the number of satellites to be added to the list of children.</param>
        protected void AddSatellites(int maxCount)
        {
            var count = Random.Randint("satellite count", (int)(0.3 * maxCount), maxCount);
            var j     = 0;

            for (var i = 0; i < count;)
            {
                j++;
                var satellite = NewSatellite(j.ToString());
                if (satellite.Orbit.SemiMajorAxis > SphereOfInfluence)
                {
                    i = count;
                }
                else
                if (!ChildrenDict.ContainsKey(satellite.Name))
                {
                    Children.Add(satellite);
                    ChildrenDict.Add(satellite.Name, satellite);
                    i++;
                }
            }
        }