예제 #1
0
    void makeMap()
    {
        EblockItem EI = new EblockItem(int.Parse(m_IFxPos.text), int.Parse(m_IFyPos.text));
        MapLoader  ML = GameObject.Find("MapCreator").GetComponent <MapLoader>();

        ML.setData(EI);
        ML.loadMap();
        destroyDialog();
    }
예제 #2
0
    void loadButtonClick()
    {
        print("로드버튼");
        EblockItem ei = ManageData.loadData("");
        MapLoader  ML = GameObject.Find("MapCreator").GetComponent <MapLoader>();

        ML.destroyCurrentMap();
        ML.setData(ei);
        ML.loadMap();
    }
예제 #3
0
    public void destroyCurrentMap()
    {
        while (blockList.Count != 0)
        {
            GameObject temp = blockList[0];
            blockList.RemoveAt(0);
            Destroy(temp);
        }

        mapData = null;
    }
예제 #4
0
    public static EblockItem loadData(string fileName)
    {
        string[] data    = result.Split(',');
        string   mapName = data[0].Replace("\n", "");

        int x = int.Parse(data[1]);
        int y = int.Parse(data[2]);

        string map = data[3].Replace("\n", "");

        EblockItem ei = new EblockItem();

        ei.init(x, y, mapName);

        for (int i = 0; i < y; i++)
        {
            for (int j = 0; j < x; j++)
            {
                switch (int.Parse(map[i * x + j].ToString()))
                {
                case (int)nodeProp.START:
                {
                    ei.setItem(j, i, nodeProp.START);
                    break;
                }

                case (int)nodeProp.GOAL:
                {
                    ei.setItem(j, i, nodeProp.GOAL);
                    break;
                }

                case (int)nodeProp.WALL:
                {
                    ei.setItem(j, i, nodeProp.WALL);
                    break;
                }

                case (int)nodeProp.EMPTY:
                {
                    ei.setItem(j, i, nodeProp.EMPTY);
                    break;
                }
                }
            }
        }

        return(ei);
    }
예제 #5
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);
    }
예제 #6
0
 public void setData(EblockItem map)
 {
     mapData = map;
 }