Ejemplo n.º 1
0
        protected override void InitCanvas()
        {
            titleContent = new GUIContent("AI Designer");
            base.InitCanvas();
            GraphCanvas.LocalRect = new Rect(-50000, -50000, 100000, 100000);

            mWires = new BTWireGUI(this);
            GraphCanvas.AddElement(mWires);

            AIGraph           = new EditorGUICanvas();
            AIGraph.LocalRect = new Rect(-50000, -50000, 100000, 100000);
            GraphCanvas.AddElement(AIGraph);

            RootNode = new BTRootNodeGUI(this);
            AIGraph.AddElement(RootNode);

            BlackboardMonitor           = new BlackboardMonitorGUI(this);
            BlackboardMonitor.LocalRect = new Rect(0, 0, 200, 180);
            RootCanvas.AddElement(BlackboardMonitor);

            HelpBox           = new BehaviourHelpGUI();
            HelpBox.SortOrder = -10;
            RootCanvas.AddElement(HelpBox);

            mSelectionRect         = new EditorSelection();
            mSelectionRect.Visible = false;
            GraphCanvas.AddElement(mSelectionRect);

            Tip = new TipBox();
            RootCanvas.AddElement(Tip);

            RootCanvas.Resort(true);
        }
Ejemplo n.º 2
0
        public BehaviourTreeDesignerWindow() : base()
        {
            mMaxScale            = 2;
            GraphCanvas.GridSize = 200;
            SelectionRect        = new SelectionGUI();
            RootCanvas.AddElement(SelectionRect);
            ScaledCanvas.Pivot = new Vector2(0.5f, 0.25f);
            GraphCanvas.Pivot  = new Vector2(0.5f, 0.1f);
            Rect r = GraphCanvas.LocalRect;

            r.position            = new Vector2(-0.5f * r.width, -0.1f * r.height);
            GraphCanvas.LocalRect = r;

            TreeGraph = new Graph <PaintElement>(1);

            Rect grect = new Rect(-GraphCanvas.LocalRect.size * 0.5f, GraphCanvas.LocalRect.size);
            BehaviourTreeWireGUI wires = new BehaviourTreeWireGUI(this);

            wires.LocalRect = grect;
            GraphCanvas.AddElement(wires);

            TreeCanvas           = new EditorGUICanvas();
            TreeCanvas.LocalRect = grect;
            GraphCanvas.AddElement(TreeCanvas);

            CommentCanvas           = new EditorGUICanvas();
            CommentCanvas.SortOrder = -2;
            CommentCanvas.LocalRect = grect;
            GraphCanvas.AddElement(CommentCanvas);

            ContextMenu = new BehaviourTreeContextMenuGUI(this);
            GraphCanvas.AddElement(ContextMenu);

            BlackboardMonitorGUI blackboard = new BlackboardMonitorGUI(this);

            blackboard.LocalRect = new Rect(0, 0, 200, 180);
            RootCanvas.AddElement(blackboard);

            RootCanvas.Resort(true);

            GraphCanvas.OnDragBegin  = OnGraphDragBegin;
            GraphCanvas.OnDrag       = OnGraphDrag;
            GraphCanvas.OnDragEnd    = OnGraphDragEnd;
            GraphCanvas.OnMouseClick = OnGraphClick;
            GraphCanvas.OnKeyUp      = OnGraphKeyUp;
        }