Beispiel #1
0
    public void Load()
    {
        SaveData save = JsonUtility.FromJson <SaveData>(File.ReadAllText(savePath));

        atomManager.DeleteAllAtoms();
        moleculeManager.DeleteAllMolecules();
        materialManager.DeleteAllMaterials();
        foreach (AtomSaveData atomData in save.atoms)
        {
            atomManager.SpawnFromSaveData(atomData);
        }
        foreach (MoleculeSaveData moleculeData in save.molecules)
        {
            populateMoleculeList.AddMolecule(moleculeData.name, moleculeData.position,
                                             moleculeData.moleculeId);
        }
        foreach (MaterialSaveData materialData in save.materials)
        {
            materialManager.SpawnMaterialFromSave(materialData.position, materialData.materialId,
                                                  materialData.name, materialData.modelFile);
        }
    }