/*
     * public int[,,] Map;
     * public char[,,] PathMap;
     * public int xsize;
     * public int ysize;
     * public int zsize;
     * public int yscale;
     * public int level;
     * public int yslices;
     * public List<Thing> ThingList;
     * public List<MonsterThing> MonsterThingList;
     */

    public SaveMap Save()
    {
        SaveMap saveMap = new SaveMap();

        saveMap.Map     = new int[xsize * ysize * zsize];  //Map;
        saveMap.PathMap = new char[xsize * ysize * zsize]; //PathMap;

        for (int k = 0; k < ysize; k++)
        {
            for (int j = 0; j < zsize; j++)
            {
                for (int i = 0; i < xsize; i++)
                {
                    saveMap.Map[i + j * xsize + k * xsize * zsize]     = Map[i, k, j];
                    saveMap.PathMap[i + j * xsize + k * xsize * zsize] = PathMap[i, k, j];
                }
            }
        }

        saveMap.xsize   = xsize;
        saveMap.ysize   = ysize;
        saveMap.zsize   = zsize;
        saveMap.yscale  = yscale;
        saveMap.level   = level;
        saveMap.yslices = yslices;
        GameObject[] objlist;
        string[]     tags = { "Items", "Decorations", "Plant", "Ladder", "Stairs", "Monster" };
        foreach (string thistag in tags)
        {
            objlist = GameObject.FindGameObjectsWithTag(thistag);
            if (objlist.Length > 0)
            {
                foreach (GameObject thisobj in objlist)
                {
                    if (thisobj.transform.parent == null)
                    {
                        if (thistag == "Monster")
                        {
                            saveMap.AddMonsterThing(thisobj);
                        }
                        else
                        {
                            saveMap.AddThing(thisobj);
                        }
                    }
                }
            }
        }
        return(saveMap);
    }