public static void Load(string saveName) { if (!File.Exists(saveName + ".txt")) { return; } //Czyszczenie układu z planet while (PlanetData.Planets.Count != 0) { PlanetManager.Destroy(PlanetData.Planets[0]); } using (StreamReader sr = new StreamReader(saveName + ".txt")) { while (!sr.EndOfStream) { IMovingPlanet planet = PlanetManager.Create(); planet.PlanetName = sr.ReadLine(); planet.Size = float.Parse(sr.ReadLine()); planet.Mass = float.Parse(sr.ReadLine()); planet.Speed = float.Parse(sr.ReadLine()); planet.SunDistance = float.Parse(sr.ReadLine()); planet.Material = sr.ReadLine(); } } Factory.GetUIController().RefreshSelectPlanetDropdown(); }
/// <summary> /// Dodawanie planety do układu słonecznego /// </summary> private void AddPlanetButtonClick() { IMovingPlanet planet = (Planet)PlanetManager.Create(); CameraFocus.OnPlanet(planet, true); }