private void CreateFollowMachine(Graph graph)
        {
            var bRect = _selectedNodes.BoundigRect();

            _fmNode =
                (FollowMachineNode)graph.Editor().Repository.CreateNode(
                    typeof(FollowMachineNode),
                    bRect.center);

            if (_fmNode != null)
            {
                _fMachine = graph.Editor().Repository.CreateFollowMachine("Follow Machine");

                _fmNode.FollowMachine = _fMachine;

                _inputNode = (InputNode)_fMachine.Editor().Repository.CreateNode(typeof(InputNode), bRect.center);


                _outputNode = (OutputNode)_fMachine.Editor().Repository.CreateNode(typeof(OutputNode), bRect.center);

                _inputNode.Editor().Move(Vector2.left * (bRect.width / 2 + 300));

                _outputNode.Editor().Move(Vector2.right * (bRect.width / 2 + 200));


                _fMachine.Position = graph.Position;
                _fMachine.Zoom     = graph.Zoom;

                _fmNode.Editor().OnShow();
            }
        }
        private void OnDragMenuClick(object o)
        {
            Type type = (Type)o;

            if (_canvas == null)
            {
                return;
            }

            if (_canvas.Graph == null)
            {
                return;
            }

            if (type == typeof(ActionNode))
            {
                ActionNode actionNode =
                    (ActionNode)_canvas.Graph.Editor().Repository.CreateNode(type, _lastMousePosition);;

                actionNode.TargetGameObject = (GameObject)_dragGameObject;
            }

            if (type == typeof(FollowMachineNode))
            {
                FollowMachineNode followMachineNode =
                    (FollowMachineNode)_canvas.Graph.Editor().Repository.CreateNode(type, _lastMousePosition);;

                followMachineNode.FollowMachine = _dragGameObject.GetComponent <FollowMachine>();
                followMachineNode.Editor().UpdateFollowMachine();
            }

            if (type == typeof(WindowNode))
            {
                WindowNode windowNode =
                    (WindowNode)_canvas.Graph.Editor().Repository.CreateNode(type, _lastMousePosition);;

                windowNode.Window = _dragGameObject.GetComponent <MgsUIWindow>();
                windowNode.Editor().OnShow();
            }

            if (type == typeof(DialogeNode))
            {
                DialogeNode dialogeNode =
                    (DialogeNode)_canvas.Graph.Editor().Repository.CreateNode(type, _lastMousePosition);;

                dialogeNode.Window = _dragGameObject.GetComponent <MgsDialougWindow>();
                dialogeNode.Editor().OnShow();
            }
        }
示例#3
0
 public static EFollowMachineNode Editor(this FollowMachineNode node) =>
 Editor <EFollowMachineNode>(node);