void Save(string path) { try { SAVEBLOCKDATA data = new SAVEBLOCKDATA(); data.blocks = new BLOCK[m_MapLoad.blocks.Length]; data.row = m_MapLoad.GetRowCount(); data.col = m_MapLoad.GetColCount(); for (int i = 0; i < m_MapLoad.blocks.Length; i++) { data.blocks[i] = m_MapLoad.blocks[i].GetComponent <BlockHive>().GetBlockInfo(); } File.WriteAllText(path, JsonConvert.SerializeObject(data)); } catch (System.Exception e) { Debug.Log(e); } }
// // 블록을 생성해서 아래로 내려주기 때문에 젤 꼭대기에 있는 하이브 블록만 저장한다. // void SetCreateBlockPosition() { int row = m_MapLoad.GetRowCount(); int col = m_MapLoad.GetColCount(); int interval = 0; for (int i = 0; i < row * col; i++) { if (i != 0 && i % row == 0) { if (CreateBlockPosition.Count != 0) { break; } interval += 7; } int index = (i * row) + interval; if (m_MapLoad.blocks[index] != null) { CreateBlockPosition.Add(m_MapLoad.blocks[index]); } } }