private void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            Debug.Log("Saving data!");

            var ourList = new XMLExample[3];
            ourList [0] = new XMLExample();
            ourList [1] = new XMLExample();
            ourList [2] = new XMLExample();

            ourList [0].Initialize(1, "Lightning", 499, 5.0f);
            ourList [1].Initialize(4, "Earth", 550, 7.0f);
            ourList [2].Initialize(20, "Water", 600, 8.0f);

            XMLData.SaveObjects("Potato", "Mashed", ourList);

            Debug.Log("Data saving complete! Saved to: " + "Potato/Mashed.xml");
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            Debug.Log("Starting load!");

            var ourExampleResults = XMLData.LoadObjects("Potato", "Mashed.xml");

            foreach (var e in ourExampleResults)
            {
                Debug.Log("CastCount: " + e.CastCount + "\nDamage: " + e.Damage + "\nDamageAmount: " + e.DamageAmount + "\nCastingTime: " + e.CastingTime);
            }
        }
    }
Esempio n. 2
0
    void Update()
    {
        if (Input.GetKeyDown (KeyCode.S)) {
            Debug.Log ("Saving data!");

            XMLExample[] ourList = new XMLExample[3];
            ourList [0] = new XMLExample ();
            ourList [1] = new XMLExample ();
            ourList [2] = new XMLExample ();

            ourList [0].Initialize (1, "Lightning", 499, 5.0f);
            ourList [1].Initialize (4, "Earth", 550, 7.0f);
            ourList [2].Initialize (20, "Water", 600, 8.0f);

            XMLData.SaveObjects ("Potato", "Mashed", ourList);

            Debug.Log ("Data saving complete! Saved to: " + "Potato/Mashed.xml");
        }

        if (Input.GetKeyDown (KeyCode.D)) {
            Debug.Log ("Starting load!");

            XMLExample[] ourExampleResults = XMLData.LoadObjects ("Potato", "Mashed.xml");

            foreach (XMLExample e in ourExampleResults) {
                Debug.Log ("CastCount: " + e.castCount + "\nDamage: " + e.damage + "\nDamageAmount: " + e.damageAmount + "\nCastingTime: " + e.castingTime);

            }
        }
    }
Esempio n. 3
0
 public void SaveData(string folderPath, string fileName, XMLExample[] objToSave)
 {
     XMLData.SaveObjects (folderPath, fileName, objToSave);
 }