Exemplo n.º 1
0
        public static void UnloadGraph()
        {
            vFSMNodeEditorWindow curwindow = EditorWindow.GetWindow <vFSMNodeEditorWindow>();

            if (curwindow != null)
            {
                if (curwindow.curGraph != null && Selection.activeObject == curwindow.curGraph)
                {
                    Selection.activeObject = null;
                }
                curwindow.curGraph = null;
            }
        }
 public static void InitEditorWindow()
 {
     curWindow = (vFSMNodeEditorWindow)EditorWindow.GetWindow <vFSMNodeEditorWindow>("AI FSM", false, typeof(SceneView));
     curWindow.titleContent.image = Resources.Load("Textures/Editor/FSMIconWindow") as Texture2D;
     CreateViews();
     if (curWindow.workView != null && curWindow.curGraph && curWindow.curGraph.states.Count > 0)
     {
         var states = curWindow.curGraph.states;
         for (int i = 0; i < states.Count; i++)
         {
             states[i].inDrag = false;
         }
         curWindow.workView.CenterView(curWindow.curGraph);
     }
 }
Exemplo n.º 3
0
        public static void LoadGraph()
        {
            vFSMBehaviour curGraph  = null;
            string        graphPath = EditorUtility.OpenFilePanel("Load FSM Behaviour", Application.dataPath + "/Invector-AIController/", "asset");

            if (!string.IsNullOrEmpty(graphPath))
            {
                int    dataPathLength = Application.dataPath.Length - 6;
                string finalPah       = graphPath.Substring(dataPathLength);
                curGraph = (vFSMBehaviour)AssetDatabase.LoadAssetAtPath(finalPah, typeof(vFSMBehaviour));

                vFSMNodeEditorWindow curwindow = EditorWindow.GetWindow <vFSMNodeEditorWindow>();
                if (curwindow != null)
                {
                    curwindow.curGraph     = curGraph;
                    Selection.activeObject = curGraph;
                }
            }
        }
 static void CreateViews()
 {
     if (!curWindow)
     {
         curWindow = (vFSMNodeEditorWindow)EditorWindow.GetWindow <vFSMNodeEditorWindow>("AI FSM", false, typeof(SceneView));
         curWindow.titleContent.image = Resources.Load("Textures/Editor/FSMIconWindow") as Texture2D;
     }
     if (curWindow != null)
     {
         curWindow.GetEditorSkin();
         curWindow.workView = new vFSMWorkView();
         curWindow.workView.InitView();
         curWindow.propertyView = new vFSMPropertyView();
         curWindow.propertyView.InitView();
         curWindow.propertyView.viewRect = new Rect(0, curWindow.toobarSize, curWindow.position.width * curWindow.fsmPropertyViewSize + curWindow.fsmViewOffset, curWindow.position.height - curWindow.toobarSize);
         curWindow.workView.viewRect     = new Rect(curWindow.propertyView.viewRect.width, curWindow.toobarSize, (curWindow.position.width - curWindow.propertyView.viewRect.width), curWindow.position.height - curWindow.toobarSize);
         curWindow.dragFSMSize           = new Rect(curWindow.propertyView.viewRect.width - 2.5f, curWindow.toobarSize, 5f, curWindow.position.height - curWindow.toobarSize);
     }
 }