示例#1
0
    void ReadCatch()
    {
        AStarMap map = AStarMapStream.Read(Application.dataPath + "/MapCatch");

        FromMap(map);
        FileUtil.DeleteFileOrDirectory(Application.dataPath + "/MapCatch");
    }
示例#2
0
 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.");
 }
示例#3
0
    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);
    }
示例#4
0
    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);
    }
示例#5
0
    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.");
    }
示例#6
0
 // 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);
 }
示例#7
0
 void MapCatch()
 {
     AStarMapStream.Write(ToMap(), Application.dataPath + "/MapCatch");
 }