static void TESTClone(PlanetarySystem systemToClone) { var clone = systemToClone.Clone(); clone.Name += "CLONE"; clone.Star.Name += "CLONE"; clone.Planets.ToList().ForEach(p => p.Name += "CLONE"); clone.Moons.ToList().ForEach(m => m.Name += "CLONE"); clone.Asteroids.ToList().ForEach(a => a.Name += "CLONE"); clone.Moons.ToList().ForEach(art => art.Name += "CLONE"); Console.WriteLine(systemToClone.Name); Console.WriteLine(systemToClone.Star.Name); systemToClone.Planets.ToList().ForEach(p => Console.WriteLine(p.Name)); systemToClone.Moons.ToList().ForEach(m => Console.WriteLine(m.Name)); systemToClone.Asteroids.ToList().ForEach(a => Console.WriteLine(a.Name)); systemToClone.ArtificialObjects.ToList().ForEach(art => Console.WriteLine(art.Name)); Console.WriteLine(); Console.WriteLine(clone.Name); Console.WriteLine(clone.Star.Name); clone.Planets.ToList().ForEach(p => Console.WriteLine(p.Name)); clone.Moons.ToList().ForEach(m => Console.WriteLine(m.Name)); clone.Asteroids.ToList().ForEach(a => Console.WriteLine(a.Name)); clone.ArtificialObjects.ToList().ForEach(art => Console.WriteLine(art.Name)); }
private void Restore() { currentPlanetarySystem = backupPlanetarySystem.Clone(); }
private void Backup() { backupPlanetarySystem = currentPlanetarySystem.Clone(); }