Ejemplo n.º 1
0
 void FindAllAniInControl(UnityEditorInternal.StateMachine machine, List<AnimationClip> list)
 {
     for (int i = 0; i < machine.stateCount; i++)
     {
         var m = machine.GetState(i).GetMotion();
         if (list.Contains(m as AnimationClip) == false)
         {
             list.Add(m as AnimationClip);
         }
     }
     for (int i = 0; i < machine.stateMachineCount; i++)
     {
         var m = machine.GetStateMachine(i);
         FindAllAniInControl(m, list);
     }
 }
 static ControllerStateMachine ConverStateMachine(UnityEditorInternal.StateMachine stateMachine, ControllerState[] states)
 {
     return new ControllerStateMachine() {
         name = stateMachine.name,
         hash = Animator.StringToHash(stateMachine.name),
         states = states.Where(i => stateMachine.EnumerateStates().Any(j => j.uniqueNameHash==i.uniqueNameHash)).ToArray(),
         subStateMachines = Enumerable.Range(0, stateMachine.stateMachineCount).Select(i => ConverStateMachine(stateMachine.GetStateMachine(i),states)).ToArray()
     };
 }