public override void Connect(UnityEditor.Graphs.AnimationStateMachine.Node toNode, UnityEditor.Graphs.Edge edge)
 {
     if (toNode is StateNode)
     {
         base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineTransition(this.stateMachine, (toNode as StateNode).state);
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
     else if (toNode is StateMachineNode)
     {
         UnityEditor.Graphs.AnimationStateMachine.Node.GenericMenuForStateMachineNode(toNode as StateMachineNode, true, delegate(object data) {
             if (data is AnimatorState)
             {
                 base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineTransition(this.stateMachine, data as AnimatorState);
             }
             else
             {
                 base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineTransition(this.stateMachine, data as AnimatorStateMachine);
             }
             base.graphGUI.stateMachineGraph.RebuildGraph();
         });
     }
     else if (toNode is ExitNode)
     {
         base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineExitTransition(this.stateMachine);
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
 }
 public override void Connect(UnityEditor.Graphs.AnimationStateMachine.Node toNode, UnityEditor.Graphs.Edge edge)
 {
     if (toNode is StateNode)
     {
         base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition((toNode as StateNode).state);
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
     if (toNode is StateMachineNode)
     {
         StateMachineNode node = toNode as StateMachineNode;
         if (node.stateMachine != base.graphGUI.parentStateMachine)
         {
             UnityEditor.Graphs.AnimationStateMachine.Node.GenericMenuForStateMachineNode(toNode as StateMachineNode, true, delegate(object data) {
                 if (data is AnimatorState)
                 {
                     base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition(data as AnimatorState);
                 }
                 else if (data is AnimatorStateMachine)
                 {
                     base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition(data as AnimatorStateMachine);
                 }
                 base.graphGUI.stateMachineGraph.RebuildGraph();
             });
         }
     }
     if (toNode is EntryNode)
     {
         base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition(base.graphGUI.activeStateMachine);
     }
 }
Exemple #3
0
 private void CreateSelectorEdges(AnimatorTransition transition, AnimatorStateMachine owner, AnimatorStateMachine sourceStateMachine)
 {
     UnityEditor.Graphs.AnimationStateMachine.Node srcNode = this.FindNodeForEdges(sourceStateMachine);
     if (!(srcNode is EntryNode))
     {
         UnityEditor.Graphs.AnimationStateMachine.Node dstNode = null;
         if (transition.destinationStateMachine != null)
         {
             dstNode = this.FindNodeForEdges(transition.destinationStateMachine);
         }
         else if (transition.destinationState != null)
         {
             dstNode = this.FindNodeForEdges(transition.destinationState);
         }
         else if (transition.isExit)
         {
             dstNode = this.m_ExitNode;
         }
         StateMachineNode node3 = srcNode as StateMachineNode;
         if ((!transition.isExit || (srcNode == null)) || ((node3 == null) || (node3.stateMachine == sourceStateMachine)))
         {
             this.CreateEdges(srcNode, dstNode, new TransitionEditionContext(transition, null, sourceStateMachine, owner));
         }
     }
 }
Exemple #4
0
 private void CreateDefaultStateEdge(AnimatorState defaultState, AnimatorStateMachine owner)
 {
     if (defaultState != null)
     {
         UnityEditor.Graphs.AnimationStateMachine.Node dstNode = this.FindNodeForEdges(defaultState);
         if (dstNode != null)
         {
             this.CreateEdges(this.m_EntryNode, dstNode, new TransitionEditionContext(null, null, null, owner));
         }
     }
 }
Exemple #5
0
        private void CreateAnyStateEdges(AnimatorStateTransition transition)
        {
            bool flag  = transition == null;
            bool flag2 = (transition.destinationState != null) && (transition.destinationState.FindParent(this.rootStateMachine) != this.activeStateMachine);
            bool flag3 = (transition.destinationStateMachine != null) && (this.rootStateMachine.FindParent(transition.destinationStateMachine) != this.activeStateMachine);
            bool flag4 = (transition.destinationStateMachine != null) && (transition.destinationStateMachine != this.activeStateMachine);

            if ((!flag && !flag2) && (!flag3 || !flag4))
            {
                UnityEditor.Graphs.AnimationStateMachine.Node dstNode = (transition.destinationState == null) ? this.FindNodeForEdges(transition.destinationStateMachine) : this.FindNodeForEdges(transition.destinationState);
                this.CreateEdges(this.m_AnyStateNode, dstNode, new TransitionEditionContext(transition, null, null, this.rootStateMachine));
            }
        }
Exemple #6
0
 private void CreateEntryEdges(AnimatorTransition transition, AnimatorStateMachine owner)
 {
     UnityEditor.Graphs.AnimationStateMachine.Node dstNode = null;
     if (transition.destinationStateMachine != null)
     {
         dstNode = this.FindNodeForEdges(transition.destinationStateMachine);
     }
     else
     {
         dstNode = this.FindNodeForEdges(transition.destinationState);
     }
     this.CreateEdges(this.m_EntryNode, dstNode, new TransitionEditionContext(transition, null, null, owner));
 }
 public override void Connect(UnityEditor.Graphs.AnimationStateMachine.Node toNode, UnityEditor.Graphs.Edge edge)
 {
     if (toNode is StateNode)
     {
         if (this.draggingDefaultState)
         {
             this.m_StateMachine.defaultState = (toNode as StateNode).state;
         }
         else
         {
             this.m_StateMachine.AddEntryTransition((toNode as StateNode).state);
         }
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
     else if (toNode is StateMachineNode)
     {
Exemple #8
0
 public UnityEditor.Graphs.AnimationStateMachine.Node FindNode(AnimatorState state)
 {
     if (this.m_StateNodeLookup.ContainsKey(state))
     {
         return(this.m_StateNodeLookup[state]);
     }
     UnityEditor.Graphs.AnimationStateMachine.Node node2 = this.FindStateMachineNodeFromState(state, this.activeStateMachine);
     if (node2 != null)
     {
         return(node2);
     }
     if ((this.parentStateMachine != null) && this.HasState(this.rootStateMachine, state, true))
     {
         return(this.m_StateMachineNodeLookup[this.parentStateMachine]);
     }
     return(null);
 }
Exemple #9
0
 private void CreateStateEdges(AnimatorState sourceState, AnimatorStateTransition transition)
 {
     UnityEditor.Graphs.AnimationStateMachine.Node srcNode  = this.FindNodeForEdges(sourceState);
     UnityEditor.Graphs.AnimationStateMachine.Node exitNode = this.m_ExitNode;
     if (transition.destinationStateMachine != null)
     {
         exitNode = this.FindNodeForEdges(transition.destinationStateMachine);
     }
     else if (transition.destinationState != null)
     {
         exitNode = this.FindNodeForEdges(transition.destinationState);
     }
     if (!(exitNode is EntryNode) && (!transition.isExit || (transition.isExit && (srcNode is StateNode))))
     {
         this.CreateEdges(srcNode, exitNode, new TransitionEditionContext(transition, sourceState, null, null));
     }
 }
Exemple #10
0
        private bool IsCurrentStateMachineNodeLiveLinked(UnityEditor.Graphs.AnimationStateMachine.Node n)
        {
            StateMachineNode node = n as StateMachineNode;

            if (node != null)
            {
                AnimatorState currentState = this.liveLinkInfo.currentState;
                bool          flag         = this.activeStateMachine.HasState(currentState, true);
                bool          flag2        = node.stateMachine.HasState(currentState, true);
                bool          flag3        = node.stateMachine.HasStateMachine(this.activeStateMachine, false);
                if (((flag3 && flag2) && !flag) || (!flag3 && flag2))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #11
0
 private void CreateEdges(UnityEditor.Graphs.AnimationStateMachine.Node srcNode, UnityEditor.Graphs.AnimationStateMachine.Node dstNode, TransitionEditionContext context)
 {
     if ((srcNode != null) && (dstNode != null))
     {
         string key = GenerateConnectionKey(srcNode, dstNode);
         if (this.m_ConnectedSlotsCache.ContainsKey(key))
         {
             this.m_ConnectedSlotsCache[key].Add(context);
         }
         else if ((srcNode != dstNode) || (((context.sourceState == null) || this.HasState(this.activeStateMachine, context.sourceState, false)) && ((context.sourceStateMachine == null) || this.HasStateMachine(this.activeStateMachine, context.sourceStateMachine, false))))
         {
             Slot fromSlot = srcNode.outputSlots.First <Slot>();
             Slot toSlot   = dstNode.inputSlots.First <Slot>();
             this.Connect(fromSlot, toSlot);
             this.m_ConnectedSlotsCache.Add(key, new EdgeInfo(context));
         }
     }
 }
Exemple #12
0
 public virtual void Connect(UnityEditor.Graphs.AnimationStateMachine.Node toNode, UnityEditor.Graphs.Edge edge)
 {
 }