コード例 #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);
        }
コード例 #2
0
ファイル: PoolableObject.cs プロジェクト: nickc01/WeaverCore
 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);
         }
     }
 }
コード例 #3
0
        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);
        }