Пример #1
0
    public void Add(IEnumerable <IPlanet> planetsToAdd)
    {
        foreach (var planet in planetsToAdd)
        {
            if (centralStar == planet)
            {
                continue;
            }

            if (this.Planets.Contains(planet))
            {
                continue;
            }

            planet.SimulatedEntity.Velocity = OrbitalMath.GetVelocityForCircularOrbitAtRadius(
                planet.SimulatedEntity.Position - centralStar.SimulatedEntity.Position,
                centralStar.SimulatedEntity.Mass);

            solver.AddEntity(planet.SimulatedEntity);
            this.Planets.Add(planet);
        }
    }