Esempio n. 1
0
    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();
    }
Esempio n. 2
0
 /// <summary>
 /// Usunięcie planety z układu słonecznego
 /// </summary>
 private void PlanetMenuDeleteButtonClick()
 {
     PlanetManager.Destroy(PlanetData.SelectedPlanet);
     MenuSwitcher.Switch(MenuState.Free);
     CameraFocus.Unfocus();
     RefreshSelectPlanetDropdown();
 }
Esempio n. 3
0
    /// <summary>
    /// Funkcja odfocusowuje kamere po tym jak zostałą skupiona na planecie
    /// </summary>
    public static void Unfocus()
    {
        camera.State = CameraState.Unfocusing;

        newCameraPosition = previousCameraPosition;
        lookAtDirection   = previousCameraRotation;

        Factory.GetUIController().DeselectPlanetDropDown();
        MenuSwitcher.Switch(MenuState.Free);

        //Jeżeli planeta dopiero co zostala stworzona i nie została ustawiona na układzie słonecznym, to zostaje usunięta
        if (PlanetData.SelectedPlanet != null && PlanetData.SelectedPlanet.SunDistance == 220f)
        {
            PlanetManager.Destroy(PlanetData.SelectedPlanet);
        }
    }