Esempio n. 1
0
    public void loadMap()
    {
        if (mapData == null)
        {
            return;
        }

        for (int i = 0; i < mapData.m_iMapY; i++)
        {
            for (int j = 0; j < mapData.m_iMapX; j++)
            {
                GameObject tObj = Instantiate(obj, new Vector3(j - mapData.m_iMapX / 2 - blockSizeX / 2, i - mapData.m_iMapY / 2 - blockSizeY / 2, 0), Quaternion.identity, this.gameObject.transform);
                tObj.GetComponent <EBlockController>().block = mapData.getItem(j, i);
                blockList.Add(tObj);
            }
        }
    }
Esempio n. 2
0
    public static void saveData(EblockItem ei)
    {
        result = "";

        string mapName = ei.m_sMapName;
        int    x       = ei.m_iMapX;
        int    y       = ei.m_iMapY;

        result += mapName + ",\n";
        result += x + ",\n";
        result += y + ",\n";

        for (int i = 0; i < y; i++)
        {
            for (int j = 0; j < x; j++)
            {
                result += (int)(ei.getItem(j, i).property);
            }
            result += "\n";
        }
        Debug.Log(result);
    }