public void CopyNode(CharacterStateNode _node)
 {
     GetPropertyValues(ref m_onEnterActions, _node.OwningSerializedObject, "m_onEnterActions");
     GetPropertyValues(ref m_onUpdateActions, _node.OwningSerializedObject, "m_onUpdateActions");
     GetPropertyValues(ref m_onAnimatorMoveActions, _node.OwningSerializedObject, "m_animUpdateActions");
     GetPropertyValues(ref m_onExitActions, _node.OwningSerializedObject, "m_onExitActions");
 }
        private void GenerateChildrenNodes(CharacterStateNode _startingNode)
        {
            foreach (KeyValuePair <OTGCombatState, StateNodeTransition> pair in _startingNode.NodeData.StateTransitions)
            {
                Port   outPort  = _startingNode.InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(OTGCombatState));
                string portName = pair.Value.Transition.OwnerState.name.Split('_')[1];
                outPort.portName = portName;
                _startingNode.outputContainer.Add(outPort);
                _startingNode.RefreshExpandedState();
                _startingNode.RefreshPorts();
                Edge e = new Edge();

                if (pair.Value.ShouldReturnToAnExistingState)
                {
                    outPort.portColor = Color.red;
                    //CharacterStateNode n = GenerateNode(pair.Value.Transition);
                    //outPort.ConnectTo(n.InputPort);
                    //e.input = n.InputPort;
                    //e.output = outPort;
                    //n.SetPosition(new Rect((n.NodeData.Level * 150) + 150, (n.NodeData.Order * 150) + 150, 150, 150));
                    //AddElement(e);
                }
                else
                {
                    CharacterStateNode n = GenerateNode(pair.Value.Transition);
                    outPort.ConnectTo(n.InputPort);
                    e.input  = n.InputPort;
                    e.output = outPort;
                    AddElement(e);
                    GenerateChildrenNodes(n);
                }
            }
        }
 private void AddStateNodeToStack(CharacterStateNode _node)
 {
     if (!m_nodesInGraph.Contains(_node))
     {
         m_nodesInGraph.Add(_node);
     }
 }
        private void CreateStartingNodeGraph()
        {
            StateNode startingState = m_charViewData.StateTree.RootNode;

            CharacterStateNode n = GenerateNode(startingState);

            GenerateChildrenNodes(n);
        }
 private void SaveNodePositions()
 {
     for (int i = 0; i < m_nodesInGraph.Count; i++)
     {
         CharacterStateNode n        = m_nodesInGraph[i];
         Vector2            position = new Vector2(n.GetPosition().x, n.GetPosition().y);
         m_charViewData.CharacterStateGraph.SaveNodePosition(n.NodeData.OwnerState.name, position);
     }
 }
 private void CleanupGraph()
 {
     if (m_stateGraph == null)
     {
         return;
     }
     m_selectedNode = null;
     m_stateGraph.OnGraphHidden();
     ContainerElement.Q <VisualElement>("graph-area").Remove(m_stateGraph);
     m_stateGraph = null;
 }
        public void OnStateSelected(CharacterStateNode _selectedNode)
        {
            if (m_copiedStateCache != null)
            {
                m_copiedStateCache.Cleanup();
                m_copiedStateCache = null;
            }

            m_selectedNode = _selectedNode;
            PopulateStateDetailsView(_selectedNode.OwningSerializedObject);
            DisplayCopyPasteButton();
        }
        public override void AddToSelection(ISelectable selectable)
        {
            m_selectedNode = selectable as CharacterStateNode;

            if (m_selectedNode == null)
            {
                return;
            }

            m_subView.OnStateSelected(m_selectedNode);
            base.AddToSelection(selectable);
        }
        private CharacterStateNode GenerateNode(StateNode _nodeData)
        {
            CharacterStateNode n = new CharacterStateNode(_nodeData);

            AddElement(n);

            Vector2 position = m_charViewData.CharacterStateGraph.GetNodePosition(_nodeData);

            AddStateNodeToStack(n);

            Rect parentPosition = new Rect(position.x, position.y, 150, 150);

            n.SetPosition(parentPosition);

            return(n);
        }
 public void OnGraphHidden()
 {
     m_selectedNode = null;
     Clear();
 }