public static U9SerialTransition PrioritySequence( U9Transition[] transitions, float staggerTime = 0f ) { //Debug.Log ("START PRIORITY SEQUENCE -------------"); List<U9Transition> transList = new List<U9Transition>( transitions ); //transList.Sort( CompareTransitionPriority ); IEnumerable enumerator = transList.OrderBy (t => t.Priority); int? currentPriority = null; U9SerialTransition serial = new U9SerialTransition (); List<U9Transition> parallelGroup = new List<U9Transition> (); foreach (U9Transition t in enumerator) { if (t != null) { if (t.Priority != currentPriority) { if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition (U9T.Stagger (staggerTime, parallelGroup.ToArray ())); parallelGroup.Clear (); } currentPriority = t.Priority; } parallelGroup.Add (t); } } if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition( U9T.Stagger( staggerTime, parallelGroup.ToArray() ) ); parallelGroup.Clear (); } return serial; }
public static U9SerialTransition PrioritySequence(U9Transition[] transitions, float staggerTime = 0f) { //Debug.Log ("START PRIORITY SEQUENCE -------------"); List <U9Transition> transList = new List <U9Transition>(transitions); //transList.Sort( CompareTransitionPriority ); IEnumerable enumerator = transList.OrderBy(t => t.Priority); int?currentPriority = null; U9SerialTransition serial = new U9SerialTransition(); List <U9Transition> parallelGroup = new List <U9Transition> (); foreach (U9Transition t in enumerator) { if (t != null) { if (t.Priority != currentPriority) { if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition(U9T.Stagger(staggerTime, parallelGroup.ToArray())); parallelGroup.Clear(); } currentPriority = t.Priority; } parallelGroup.Add(t); } } if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition(U9T.Stagger(staggerTime, parallelGroup.ToArray())); parallelGroup.Clear(); } return(serial); }