예제 #1
0
        public SaveData toSaveData()
        {
            ChunkManagerData data = new ChunkManagerData();

            foreach (KeyValuePair <Vector2Int, ID> vecID in this.allChunkIDs)
            {
                Vector2IntData vecData = new Vector2IntData();
                vecData.SaveData(vecID.Key);
                data.allChunkIDs.Add(vecData, vecID.Value);
            }
            return(data);
        }
예제 #2
0
        public void fromSaveData(SaveData chunkManagerData)
        {
            Debug.Log("读取ChunkManager");
            allChunkIDs   = new Dictionary <Vector2Int, ID>();
            allChunks     = new Dictionary <Vector2Int, Chunk>();
            currentChunks = new List <Chunk>();

            ChunkManagerData data = (ChunkManagerData)chunkManagerData;

            foreach (KeyValuePair <Vector2IntData, ID> vecID in data.allChunkIDs)
            {
                this.allChunkIDs.Add(vecID.Key.GetData(), vecID.Value);
            }
        }