Beispiel #1
0
        public static int GetElementsHash <T>(this IEnumerable <T> list)
        {
            int hash = 0;

            foreach (var item in list)
            {
                HashUtilities.AdditiveHash(ref hash, item.GetHashCode());
            }
            return(hash);
        }
Beispiel #2
0
 IEnumerable <ComponentPath> RecursiveGetComponents(int SiblingHash, Transform t, List <Component> reusableList)
 {
     t.GetComponents(ComponentType, reusableList);
     for (int i = 0; i < reusableList.Count; i++)
     {
         yield return(new ComponentPath(SiblingHash, reusableList[i]));
     }
     for (int i = 0; i < t.childCount; i++)
     {
         foreach (var item in RecursiveGetComponents(HashUtilities.CombineHashCodes(SiblingHash, i), t.GetChild(i), reusableList))
         {
             yield return(item);
         }
     }
 }
        public static int GetHashOfTransform(Transform transform, bool includeChildren = true)
        {
            int hash = transform.gameObject.name.GetHashCode();

            if (includeChildren)
            {
                for (int i = 0; i < transform.childCount; i++)
                {
                    //hash = GetHashOfTransform(transform, true);
                    HashUtilities.AdditiveHash(ref hash, GetHashOfTransform(transform.GetChild(i), true));
                }
            }

            return(hash);
        }