예제 #1
0
        public PlanetarySystem Clone()
        {
            PlanetarySystem clone     = new PlanetarySystem(this.Name);
            Star            cloneStar = new Star(this.Star);

            clone.SetStar(cloneStar);

            this.Planets.ToList().ForEach(pl =>
            {
                Planet clonePlanet = new Planet(pl);
                clone.AddPlanetNOTORBITALSAFE(clonePlanet);
                pl.Moons.ToList().ForEach(m =>
                {
                    Moon cloneMoon = new Moon(m);
                    pl.AddMoonNOTORBITALSAFE(cloneMoon);
                });
            });

            this.Asteroids.ToList().ForEach(a =>
            {
                Asteroid cloneAsteroid = new Asteroid(a);
                clone.AddAsteroid(cloneAsteroid);
            });

            this.ArtificialObjects.ToList().ForEach(artObj =>
            {
                ArtificialObject cloneArtObj = new ArtificialObject(artObj);
                clone.AddArtificialObject(cloneArtObj);
            });

            return(clone);
        }
예제 #2
0
 // Methods
 public void Attach(PlanetarySystem planetarySystem)
 {
     this.PlanetarySystem = planetarySystem;
 }
예제 #3
0
 public void Attach(PlanetarySystem planetarySystem)
 {
     RemoveAllMoons();
     this.PlanetarySystem = planetarySystem;
     this.Moons           = new List <Moon>();
 }