示例#1
0
    public static void SaveMap()
    {
        string path = EditorUtility.SaveFilePanel("", "", "", "xml");

        if (path != null || path != "")
        {
            MapSerializer.Save(currentMap, path);
        }
    }
示例#2
0
    public void SaveMap()
    {
        Debug.Assert((mapAsset != null), "Invalid map asset");
        if (mapAsset != null)
        {
            mapSerializer = new MapSerializer(width, height);

            for (int row = 0; row < height; row++)
            {
                for (int column = 0; column < width; column++)
                {
                    int     index = GetCellIndex(column, row);
                    HexCell cell  = cells[index];

                    MapSerializer.CellProperties cellProperties = new MapSerializer.CellProperties();
                    cellProperties.m_Type = cell.GetType();

                    mapSerializer.SetValue(column, row, cellProperties);
                }
            }

            mapSerializer.Save(mapAsset);
        }
    }