コード例 #1
0
ファイル: UrbSystemIO.cs プロジェクト: nighzmarquls/Urbaeum
    public void LoadGameDataFromFile(string filename = "/gamesave.txt")
    {
        StreamReader file = new StreamReader(Application.dataPath + filename);
        string       load = file.ReadToEnd();

        file.Close();
        GameData = JsonUtility.FromJson <UrbSave>(load);
    }
コード例 #2
0
ファイル: UrbSystemIO.cs プロジェクト: nighzmarquls/Urbaeum
    public void CollectGameData()
    {
        if (Maps == null || Maps.Count <= 0)
        {
            Debug.LogError("Missing Reference to UrbMap, Cannot collect Game Data");
            return;
        }
        if (AgentTypes == null || AgentTypes.Count <= 0)
        {
            Debug.LogError("Missing UrbAgent Prefab Key, Cannot collect Game Data");
            return;
        }

        GameData = new UrbSave
        {
            Maps       = new UrbMapData[Maps.Count],
            OffsetTime = CurrentTime
        };

        for (int i = 0; i < Maps.Count; i++)
        {
            GameData.Maps[i] = Maps[i].GetMapData();
        }
    }