void ReadCatch() { AStarMap map = AStarMapStream.Read(Application.dataPath + "/MapCatch"); FromMap(map); FileUtil.DeleteFileOrDirectory(Application.dataPath + "/MapCatch"); }
public void SaveMapAs() { if (m_cellArray == null) { return; } m_filePath = EditorUtility.SaveFilePanel("Save map file", Application.dataPath, "", "txt"); if (string.IsNullOrEmpty(m_filePath)) { return; } AStarMapStream.Write(ToMap(), m_filePath); Debug.Log("Save success."); }
public void ReadMap() { if (!string.IsNullOrEmpty(m_filePath)) { SaveMap(); } m_filePath = EditorUtility.OpenFilePanel("Read map file", Application.dataPath, "txt"); if (string.IsNullOrEmpty(m_filePath)) { return; } AStarMap map = AStarMapStream.Read(m_filePath); FromMap(map); }
public void ReadMap(string fileName) { Debug.Log("MapCtr::ReadMap"); Debug.Log(GameDebug.GetInvokeClassAndMethodName(1)); Debug.Log(GameDebug.GetInvokeClassAndMethodName(2)); Debug.Log(GameDebug.GetInvokeClassAndMethodName(3)); if (string.IsNullOrEmpty(fileName)) { return; } Debug.Log(Application.dataPath); string dir = Application.dataPath + "/"; PathfindingMap = AStarMapStream.Read(dir + fileName + "_astar.txt"); MapData map = MapStream.Read(dir + fileName + ".txt"); FromMapData(map); }
public void AutoAStarMap() { if (cells == null) { return; } string filePath; filePath = EditorUtility.SaveFilePanel("Save map file", Application.dataPath, "", "txt"); if (string.IsNullOrEmpty(filePath)) { return; } AStarMap map = SpriteMap2AStarMap.SpriteMapToAStarMap(ToMapData()); AStarMapStream.Write(map, filePath); Debug.Log("AutoAStarMap success."); }
// Use this for initialization void Start() { map = AStarMapStream.Read(Application.dataPath + "/scene1.txt"); map.CalculateCellPosition(new Vector2(2.56f, 2.56f), Vector2.zero); path = AStar.CalculatePath(map.GetCell(0, 0), map.GetCell(map.Row - 1, map.Column - 1), map); }
void MapCatch() { AStarMapStream.Write(ToMap(), Application.dataPath + "/MapCatch"); }