Exemple #1
0
        static protected void processHierarchy(Transform rootTransform, TransformCallback callback,
                                               TransformFilter childFilter = null)
        {
            if (callback == null)
            {
                throw new System.ArgumentNullException("callback");
            }
            if (!rootTransform)
            {
                return;                //??
            }
            var workList = new List <Transform>();

            workList.Add(rootTransform);
            for (int itemIndex = 0; itemIndex < workList.Count; itemIndex++)
            {
                var curItem = workList[itemIndex];
                if (!curItem)
                {
                    throw new System.ArgumentException("Logic error while gathering bone ids");
                }

                callback(curItem);

                foreach (Transform child in curItem)
                {
                    if ((childFilter == null) || (childFilter(child)))
                    {
                        workList.Add(child);
                    }
                }
            }
        }
Exemple #2
0
 public static TTo[] Transform <TFrom, TTo>(TFrom[] collection, TransformCallback <TFrom, TTo> callback)
 {
     TTo[] results = new TTo[collection.Length];
     for (int i = 0; i < collection.Length; ++i)
     {
         results[i] = callback(collection[i]);
     }
     return(results);
 }