Ejemplo n.º 1
0
 void OnDisable()
 {
     isFoundDestination = true;
     // bug.SetActive(false);
     // gate.SetActive(false);
     if (bug != null)
     {
         Destroy(bug);
     }
     if (bug != null)
     {
         Destroy(gate);
     }
     path.Clear();
     tempPath.Clear();
     pathManager.Clear();
     DestroyWall();
     // DisableWall();
 }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Separator();
        GUILayout.BeginHorizontal();
        EditorGUILayout.SelectableLabel(PathRecoder.ObstacleRoot);
        if (GUILayout.Button("选择障碍物路径"))
        {
            var path = EditorUtility.OpenFolderPanel("障碍物路径", PathRecoder.ObstacleRoot, "");
            path = path.Replace('\\', '/');
            if (!path.StartsWith(Application.dataPath + "/Res"))
            {
                EditorUtility.DisplayDialog("提示", "障碍物路径必须以Assets/Res开头", "确定");
                return;
            }
            if (path.Length > 0)
            {
                PathRecoder.ObstacleRoot = path;
            }
        }
        GUILayout.EndHorizontal();

        //GUILayout.BeginHorizontal();
        //EditorGUILayout.SelectableLabel(PathRecoder.EntityRoot);
        //if (GUILayout.Button("选择Entity路径"))
        //{
        //    var path = EditorUtility.OpenFolderPanel("Entity路径", PathRecoder.EntityRoot, "");
        //    path = path.Replace('\\', '/');
        //    if (!path.StartsWith(Application.dataPath + "/Res"))
        //    {
        //        EditorUtility.DisplayDialog("提示", "Entity路径必须以Assets/Res开头", "确定");
        //        return;
        //    }
        //    if (path.Length > 0) PathRecoder.EntityRoot = path;
        //}
        //GUILayout.EndHorizontal();

        if (GUILayout.Button("生成标签"))
        {
            GenerateObstacleTag();
        }
        if (GUILayout.Button("导出障碍物信息"))
        {
            ExportMapObjConfig();
        }
        if (GUILayout.Button("导出网格信息"))
        {
            ExportMapGridConfig();
        }
        //if (GUILayout.Button("导出Entity信息"))
        //{
        //    ExportMapEntityConfig();
        //}

        if (GUILayout.Button("清除缓存"))
        {
            PathManager m = target as PathManager;
            m.Clear();
        }
        EditorGUILayout.Separator();
        if (GUILayout.Button("寻路(TEST)"))
        {
            PathManager m = target as PathManager;
            m.curPath = m.FindPath(m.startPos.transform.position, m.endPos.transform.position);
        }
    }