void Start() { mapSrcObj = Resources.Load <MapScrObj>("ScriptableObj/Maps/Auto/lvl" + GameData.loadLvlNum); map = Decode(mapSrcObj.MapRule); CreateField(); AddFirstElement(); }
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(); }
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); }
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); }