/// <inheritdoc />
        public override AnimationClip[] MapArray(AssetLoaderContext assetLoaderContext, AnimationClip[] sourceAnimationClips)
        {
            if (AnimatorOverrideController != null)
            {
                for (var i = 0; i < sourceAnimationClips.Length; i++)
                {
                    var animationClip = sourceAnimationClips[i];
                    var overrides     = new List <KeyValuePair <AnimationClip, AnimationClip> >(AnimatorOverrideController.overridesCount);
                    AnimatorOverrideController.GetOverrides(overrides);
                    for (var j = 0; j < overrides.Count; j++)
                    {
                        var kvp      = overrides[j];
                        var keyName  = kvp.Key.name;
                        var clipName = animationClip.name;
                        if (StringComparer.Matches(StringComparisonMode, CaseInsensitive, keyName, clipName))
                        {
                            overrides[j] = new KeyValuePair <AnimationClip, AnimationClip>(kvp.Key, animationClip);
                        }
                    }

                    AnimatorOverrideController.ApplyOverrides(overrides);
                }
            }
            return(base.MapArray(assetLoaderContext, sourceAnimationClips));
        }
コード例 #2
0
 private Transform FindDeepChild(IList <Transform> transforms, string right)
 {
     foreach (var transform in transforms)
     {
         if (StringComparer.Matches(StringComparisonMode, CaseInsensitive, transform.name, right))
         {
             return(transform);
         }
     }
     return(null);
 }
コード例 #3
0
        private Transform FindDeepChild(Transform transform, string right)
        {
            if (StringComparer.Matches(StringComparisonMode, CaseInsensitive, transform.name, right))
            {
                return(transform);
            }

            var childCount = transform.childCount;

            for (var i = 0; i < childCount; i++)
            {
                var child = transform.GetChild(i);
                var found = FindDeepChild(child, right);
                if (found != null)
                {
                    return(found);
                }
            }
            return(null);
        }