Exemplo n.º 1
0
 private void BuildDestinationStatesRecursive(AnimatorTransitionBase transition, AnimatorStateMachine rootStateMachine, AnimatorStateMachine currentStateMachine)
 {
     if (transition.destinationState != null)
     {
         this.m_DstStates.Add(transition.destinationState);
     }
     else if (transition.isExit)
     {
         AnimatorStateMachine machine = rootStateMachine.FindParent(currentStateMachine);
         if (machine != null)
         {
             AnimatorTransition[] stateMachineTransitions = machine.GetStateMachineTransitions(currentStateMachine);
             foreach (AnimatorTransition transition2 in stateMachineTransitions)
             {
                 this.BuildDestinationStatesRecursive(transition2, rootStateMachine, machine);
             }
         }
     }
     else if ((transition.destinationStateMachine != null) && !this.m_DstStateMachines.Contains(transition.destinationStateMachine))
     {
         this.m_DstStateMachines.Add(transition.destinationStateMachine);
         if (transition.destinationStateMachine.defaultState != null)
         {
             this.m_DstStates.Add(transition.destinationStateMachine.defaultState);
         }
         AnimatorTransition[] entryTransitions = transition.destinationStateMachine.entryTransitions;
         foreach (AnimatorTransition transition3 in entryTransitions)
         {
             this.BuildDestinationStatesRecursive(transition3, rootStateMachine, transition.destinationStateMachine);
         }
     }
 }
Exemplo n.º 2
0
 private void BuildDestinationStatesRecursive(AnimatorTransitionBase transition, AnimatorStateMachine rootStateMachine, AnimatorStateMachine currentStateMachine)
 {
     if (transition.destinationState)
     {
         this.m_DstStates.Add(transition.destinationState);
     }
     else if (transition.isExit)
     {
         AnimatorStateMachine animatorStateMachine = rootStateMachine.FindParent(currentStateMachine);
         if (animatorStateMachine != null)
         {
             AnimatorTransition[] stateMachineTransitions = animatorStateMachine.GetStateMachineTransitions(currentStateMachine);
             AnimatorTransition[] array = stateMachineTransitions;
             for (int i = 0; i < array.Length; i++)
             {
                 AnimatorTransition transition2 = array[i];
                 this.BuildDestinationStatesRecursive(transition2, rootStateMachine, animatorStateMachine);
             }
         }
     }
     else if (transition.destinationStateMachine)
     {
         if (transition.destinationStateMachine.defaultState != null)
         {
             this.m_DstStates.Add(transition.destinationStateMachine.defaultState);
         }
         AnimatorTransition[] entryTransitions = transition.destinationStateMachine.entryTransitions;
         AnimatorTransition[] array2           = entryTransitions;
         for (int j = 0; j < array2.Length; j++)
         {
             AnimatorTransition transition3 = array2[j];
             this.BuildDestinationStatesRecursive(transition3, rootStateMachine, transition.destinationStateMachine);
         }
     }
 }
 private void BuildDestinationStatesRecursive(AnimatorTransitionBase transition, AnimatorStateMachine rootStateMachine, AnimatorStateMachine currentStateMachine)
 {
     if (transition.destinationState != null)
     {
         this.m_DstStates.Add(transition.destinationState);
     }
     else if (transition.isExit)
     {
         AnimatorStateMachine machine = rootStateMachine.FindParent(currentStateMachine);
         if (machine != null)
         {
             AnimatorTransition[] stateMachineTransitions = machine.GetStateMachineTransitions(currentStateMachine);
             foreach (AnimatorTransition transition2 in stateMachineTransitions)
             {
                 this.BuildDestinationStatesRecursive(transition2, rootStateMachine, machine);
             }
         }
     }
     else if ((transition.destinationStateMachine != null) && !this.m_DstStateMachines.Contains(transition.destinationStateMachine))
     {
         this.m_DstStateMachines.Add(transition.destinationStateMachine);
         if (transition.destinationStateMachine.defaultState != null)
         {
             this.m_DstStates.Add(transition.destinationStateMachine.defaultState);
         }
         AnimatorTransition[] entryTransitions = transition.destinationStateMachine.entryTransitions;
         foreach (AnimatorTransition transition3 in entryTransitions)
         {
             this.BuildDestinationStatesRecursive(transition3, rootStateMachine, transition.destinationStateMachine);
         }
     }
 }