Beispiel #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);
        }
 public ArtificialObject(ArtificialObject artificialObject)
     : this(artificialObject.Center, artificialObject.Mass, artificialObject.Radius, artificialObject.Velocity, artificialObject.Name)
 {
 }
Beispiel #3
0
 public void RemoveArtificialObject(ArtificialObject artificialObject)
 {
     this._artificialObjects.Remove(artificialObject);
     artificialObject.PlanetarySystem = null;
 }
Beispiel #4
0
 public void AddArtificialObject(ArtificialObject artificialObject)
 {
     this._artificialObjects.Add(artificialObject);
     artificialObject.PlanetarySystem = this;
 }