예제 #1
0
파일: KeyCard.cs 프로젝트: Sarngond/Orb
    public void LoadKeyCard()
    {
        KeyCardData data = SaveSystem.LoadKeyCard(gameObject);

        Debug.Log(gameObject.name + " " + data.cardObtained);
        obtainedString = data.cardObtained;
    }
예제 #2
0
파일: SaveSystem.cs 프로젝트: Sarngond/Orb
    public static void SaveKeyCard(GameObject card)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/" + card.name + ".orb";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        KeyCardData data = new KeyCardData(card);

        formatter.Serialize(stream, data);
        stream.Close();
    }
예제 #3
0
파일: SaveSystem.cs 프로젝트: Sarngond/Orb
    public static KeyCardData LoadKeyCard(GameObject card)
    {
        string path = Application.persistentDataPath + "/" + card.name + ".orb";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            KeyCardData data = formatter.Deserialize(stream) as KeyCardData;
            stream.Close();

            Debug.Log("Loaded KeyCard");

            return(data);
        }
        else
        {
            Debug.LogError("Save file not found in " + path);
            return(null);
        }
    }