Esempio n. 1
0
 public void CrearObjeto()
 {
     mg.SpawnObject(indice);
     mc.NumberObjetos++;
     if (Manager.Instance.english)
     {
         mc.ShowText("Object Created");
     }
     else
     {
         mc.ShowText("Objeto Creado");
     }
 }
Esempio n. 2
0
    public void Load()
    {
        string          dataPath        = Path.Combine(Application.streamingAssetsPath, "save.sv");
        BinaryFormatter binaryFormatter = new BinaryFormatter();

        FileStream stream = null;

        stream = File.Open(dataPath, FileMode.Open);


        SaveData save = new SaveData();

        try
        {
            save = (SaveData)binaryFormatter.Deserialize(stream);
        }
        catch
        {
            if (english)
            {
                mc.ShowText("Error reading the file, a new one will be created when returning to the main menu");
            }
            else
            {
                mc.ShowText("Error leyendo el archivo, se creara uno nuevo al volver al menu de inicio");
            }
        }


        for (int i = 0; i < save.clases.Count; i++)
        {
            for (int j = 0; j < save.clases[i].atributos.Count; j++)
            {
                ca.Load(save.clases[i].atributos[j].tipo, save.clases[i].atributos[j].proteccion, save.clases[i].atributos[j].nombre);
            }

            for (int j = 0; j < save.clases[i].metodos.Count; j++)
            {
                cm.Load(save.clases[i].metodos[j].nombre);
            }


            Material m = new Material(Shader.Find("Standard"));

            Color c = new Color(save.clases[i].color[0], save.clases[i].color[1], save.clases[i].color[2]);
            m.color = c;
            colors.Add(c.r + "," + c.g + "," + c.b, c);

            co.Load(save.clases[i].nombre, m);
        }



        for (int i = 0; i < save.variables.Count; i++)
        {
            Material c     = null;
            bool     found = false;
            for (int j = 0; j < mg.anchorablePrefs.Count && !found; j++)
            {
                if (save.variables[i].clase == mg.anchorablePrefs[j].nombre)
                {
                    found = true;
                    c     = mg.anchorablePrefs[j].Material;
                }
            }
            Material m  = new Material(Shader.Find("Standard"));
            Color    cl = new Color(save.variables[i].color[0], save.variables[i].color[1], save.variables[i].color[2]);
            m.color = cl;
            colors.Add(cl.r + "," + cl.g + "," + cl.b, cl);
            mg.SpawnVariable(save.variables[i].clase, save.variables[i].nombre, m, c);
        }



        for (int i = 0; i < save.objetos.Count; i++)
        {
            mg.SpawnObject(save.objetos[i]);
        }

        for (int i = 0; i < save.referencias.Count; i++)
        {
            if (save.referencias[i] >= 0)
            {
                mg.variables[i].objetoReferenciado = mg.objects[save.referencias[i]];
            }
        }

        c.Load(save.consola);


        stream.Close();



        if (stream != null)
        {
            stream.Close();
        }
    }