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); }
// Methods public void Attach(PlanetarySystem planetarySystem) { this.PlanetarySystem = planetarySystem; }
public void Attach(PlanetarySystem planetarySystem) { RemoveAllMoons(); this.PlanetarySystem = planetarySystem; this.Moons = new List <Moon>(); }