Exemplo n.º 1
0
    public void SaveData(xmlData data)
    {
        // load file if exist
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.OpenOrCreate);

        // save it
        bf.Serialize(file, data);
        file.Close();

        GetComponent <Notification>().SetNotification("Game Saved");
    }
Exemplo n.º 2
0
    public void SaveGame()
    {
        xmlData data = new xmlData();

        data.resources    = resources;
        data.sceneObjects = new string[generatedObjects.Count];
        // itereate thru each one
        for (int i = 0; i < generatedObjects.Count; i++)
        {
            data.sceneObjects[i] = JsonUtility.ToJson(generatedObjects[i].ObjectSaveData(), true);
        }

        SaveData(data);
    }
Exemplo n.º 3
0
    public void LoadGame()
    {
        GameController gc = GetComponent <GameController>();

        gc.WipeScene();
        if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
            xmlData         data = (xmlData)bf.Deserialize(file);
            file.Close();

            resources = data.resources;


            foreach (string s in data.sceneObjects)
            {
                SerializableObject so = JsonUtility.FromJson <SerializableObject>(s);
                gc.PlaceObjectfromSO(so);
            }

            GetComponent <Notification>().SetNotification("Game Loaded");
        }
    }
Exemplo n.º 4
0
 public XYZ()
 {
     myXML = new xmlData();
 }
Exemplo n.º 5
0
    void Start()
    {
        gameMngr = gameObject.GetComponent<GameManager>() as GameManager;
        enemyMngr = GameObject.Find("gameManager").GetComponent<EnemyManager>() as EnemyManager;
        map = GameObject.Find("gameManager").GetComponent<minimap>() as minimap;

        waveTextHolder.SetActive(false);
        waveAnounceHolder.SetActive(false);
        waveDelayTextHolder.SetActive(false);

        //LOAD WAVE DATA
        xmldata = loadXML();
        //LOAD DATA FOR LEVEL
        setupLevel();
    }