示例#1
0
 void Start()
 {
     mapSrcObj = Resources.Load <MapScrObj>("ScriptableObj/Maps/Auto/lvl" + GameData.loadLvlNum);
     map       = Decode(mapSrcObj.MapRule);
     CreateField();
     AddFirstElement();
 }
示例#2
0
    void DoStuff()
    {
        try
        {
            mapSrcObj = GameObject.Find("GameController").GetComponent <Game>().mapSrcObj;
            map       = Decode(mapSrcObj.MapRule);
            SetStartPoint(mapSrcObj.StartPoint);
        }
        catch
        {
            // Debug.Log("not in game mode");
        }

        GetFarestPoint(startPoint);
        temp.Clear();
        temp2.Clear();
        findLongestPath(map, visited, (int)startPoint.x, (int)startPoint.y, (int)endPoint.x, (int)endPoint.y, 0);
        //Debug.Log("max dist: " + _max_dist);
        CutTempPath();
        CheckUniqPathes();
    }
示例#3
0
    public void SaveScrObj()
    {
        int cln = 0;

        prefName = lvlName.text;
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col; j++)
            {
                mapLine += cells[cln].GetComponent <gCell>().value;
                cln++;
            }
            mapLine += ",";
        }
        MapScrObj tmp = ScriptableObject.CreateInstance <MapScrObj>();

        tmp.MapRule    = mapLine;
        tmp.StartPoint = startCellNum;
#if UNITY_EDITOR
        AssetDatabase.CreateAsset(tmp, "Assets/Resources/ScriptableObj/Maps/" + prefName + ".asset");
#endif
        //Debug.Log(mapLine);
    }
示例#4
0
    public void SaveScrObj()
    {
        //string prefName = lvlName.text;
        string prefName = "lvl";
        string mapLine  = "";

        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col; j++)
            {
                mapLine += map[i, j];
            }
            mapLine += ",";
        }
        MapScrObj tmp = ScriptableObject.CreateInstance <MapScrObj>();

        tmp.MapRule    = mapLine;
        tmp.StartPoint = greenIndex;
        #if UNITY_EDITOR
        AssetDatabase.CreateAsset(tmp, "Assets/Resources/ScriptableObj/Maps/Auto2/" + prefName + "" + levelNameIndex + ".asset");
        #endif
        levelNameIndex++;
        //Debug.Log(mapLine);
    }