Esempio n. 1
0
    
 // ********************************************************************** //
    

 public void LoadExistingPlanets(string filepath) 

    {
        

        // may need to write an exception case here HRS

        string json = File.ReadAllText(filepath); 


            allExistingPlanets = JsonUtility.FromJson <AllPlanetData>(json); 


        Debug.Log("Just loaded data from " + allExistingPlanets.allPlanetData.Count + " generated planets."); 

    }
Esempio n. 2
0
 
    }

    // ********************************************************************** //

    string GetDateTime() 
    {
        DateTime dateTime = DateTime.Now;
    
        string stringDateTime = dateTime.ToString("dd-MM-yy", DateTimeFormatInfo.InvariantInfo) + '_' + dateTime.ToString("T", DateTimeFormatInfo.InvariantInfo);
        stringDateTime = stringDateTime.Replace("/", "-");   // make sure you don't have conflicting characters for writing to web server
        stringDateTime = stringDateTime.Replace(":", "-");   

        return stringDateTime;
    }

    // ********************************************************************** //

    public void LoadExistingPlanets(string filepath)
    {
        // may need to write an exception case here HRS
        string json = File.ReadAllText(filepath);
        allExistingPlanets = JsonUtility.FromJson<AllPlanetData>(json);

        Debug.Log("Just loaded data from " + allExistingPlanets.allPlanetData.Count + " generated planets.");
    }

    // ********************************************************************** //

    public PlanetData CurrentPlanetSettings(string planetName) 
    {
        // This function generates local variable copies of the settings that we want to save for this planet

        planetData = new PlanetData();              // new to create a new object to store this planet's parameters