//初始化函数
    void Init()
    {
        minSize                       = new Vector2(600, 0);
        RenderSettings.fog            = false;
        _delegate                     = new SceneView.OnSceneFunc(OnSceneFunc);
        SceneView.onSceneGUIDelegate += _delegate;
        m_sBornListPath               = "";
        m_sObstaclePath               = "";
        m_sNavigationPath             = "";
        //加载选择图片
        ChangeTexture(ref _windowInstance.m_ObstcalePng);

        //加载prefab
        string sPrefabPath = "Assets/Z_Temp/Obstacle/SceneEditorPerfab/";

        //ObsPrefabs = AssetDatabase.LoadAssetAtPath( sPrefabPath + "Obstacle.prefab", typeof(GameObject)) as GameObject; ;
        RegionBorn     = AssetDatabase.LoadAssetAtPath(sPrefabPath + "RegionBorn.prefab", typeof(GameObject)) as GameObject;;
        PointBorn      = AssetDatabase.LoadAssetAtPath(sPrefabPath + "PointBorn.prefab", typeof(GameObject)) as GameObject;;
        ScenePointBorn = AssetDatabase.LoadAssetAtPath(sPrefabPath + "ScenePointBorn.prefab", typeof(GameObject)) as GameObject;;
        PathPointBorn  = AssetDatabase.LoadAssetAtPath(sPrefabPath + "PathPointBorn.prefab", typeof(GameObject)) as GameObject;
        PatrolBorn     = AssetDatabase.LoadAssetAtPath(sPrefabPath + "PatrolBorn.prefab", typeof(GameObject)) as GameObject;

        //生成各个父节点
        AllParent = GameObject.Find("Parent");
        if (AllParent == null)
        {
            GameObject parent = AssetDatabase.LoadAssetAtPath(sPrefabPath + "Parent.prefab", typeof(GameObject)) as GameObject;
            AllParent = Instantiate(parent) as GameObject;
            AllParent.transform.position = new Vector3(0, 0, 0);
            AllParent.name = AllParent.name.Replace("(Clone)", "");
        }
        m_csPathGrid             = AllParent.GetComponent <PathGridComponent>();
        m_csPathGrid.m_debugShow = true;
        CheekParent();
        m_csPathGrid.InitArray(false);
        GetFloorHeight();

        _windowInstance.position = new Rect(400, 90, 150, 940);
        BornInfoWindow.OpenWindow();
        EditerDataClass._Instance.Init();
        //InteractionTool.AddObserver(EditerDataClass._Instance);
        //InteractionTool.AddObserver(BornInfoWindow._Instance);
        // InteractionTool.InitObserver();
        //自动导入阻挡文件
        InteractionTool.Importobstacle(true);
    }
Ejemplo n.º 2
0
 public static void OpenWindow()
 {
     if (Application.isPlaying)
     {
         if (!SceneEditorWindow._windowInstance)
         {
             Debug.LogWarning("请先打开编辑窗口!");
             return;
         }
         if (!_Instance)
         {
             _Instance = EditorWindow.GetWindow <BornInfoWindow>("怪物信息窗口");
             _Instance.Init();
         }
         else
         {
             _Instance.Focus();
         }
     }
     else
     {
         Debug.LogWarning("请先运行游戏");
     }
 }