Source

HI-2DRTSSGMDDPP1 / GameProgram / GameProgram / PlanetarySystemFactory.cs

Full commit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameProgram
{
  class PlanetarySystemFactory
  {
    private PlanetFactory planetFactory;
    private MoonFactory moonFactory;

    public PlanetarySystemFactory()
    {
      planetFactory = new PlanetFactory();
      moonFactory   = new MoonFactory();
    }

    internal PlanetarySystem createPlanetarySystem( StarSystem newStarSystem, float parentOrbitalRadius, float initialLongitude )
    {     

      PlanetarySystem newPlanetarySystem = new PlanetarySystem( newStarSystem, parentOrbitalRadius, Game1.randomNumber.Next( 2 * (int)Math.PI ) );

      Planet newPlanet = planetFactory.createPlanet( newPlanetarySystem, 0.0F, 0.0F );

      Moon newMoon = moonFactory.createMoon( newPlanetarySystem, Game1.randomNumber.Next( 150, 175 ), Game1.randomNumber.Next( 2 * (int)Math.PI ) );

      newPlanetarySystem.Planet = newPlanet;
      newPlanetarySystem.addMoon( newMoon );

      newMoon = moonFactory.createMoon( newPlanetarySystem, Game1.randomNumber.Next( 300, 325 ), Game1.randomNumber.Next( 2 * (int)Math.PI ) );

      newPlanetarySystem.addMoon( newMoon );

      return newPlanetarySystem;

    }
  }
}