Пример #1
0
        private static int FindMotionIndexOnBlendTree(BlendTree blendTree, Motion motion)
        {
            int childCount = blendTree.GetChildCount();

            for (int i = 0; i < childCount; i++)
            {
                if (blendTree.GetChildMotion(i) == motion)
                {
                    return(i);
                }
            }
            return(-1);
        }
Пример #2
0
        private void SetParameterValueRecursive(BlendTree blendTree, string parameterName, float parameterValue)
        {
            blendTree.SetInputBlendValue(parameterName, parameterValue);
            int childCount = blendTree.GetChildCount();

            for (int i = 0; i < childCount; i++)
            {
                BlendTree blendTree2 = blendTree.GetChildMotion(i) as BlendTree;
                if (!(blendTree2 == null))
                {
                    this.SetParameterValueRecursive(blendTree2, parameterName, parameterValue);
                }
            }
        }
Пример #3
0
        private void CreateNodeFromBlendTreeRecursive(BlendTree blendTree, Node parentNode)
        {
            Node node = this.CreateNode(blendTree, blendTree.name);

            if (parentNode)
            {
                node.parent = parentNode;
                Slot fromSlot = parentNode.AddOutputSlot(blendTree.name);
                Slot toSlot   = node.AddInputSlot((parentNode.motion as BlendTree).name);
                this.Connect(fromSlot, toSlot);
            }
            else
            {
                this.m_RootBlendTree = blendTree;
                this.m_RootNode      = node;
            }
            int childCount = blendTree.GetChildCount();

            for (int i = 0; i < childCount; i++)
            {
                Motion childMotion = blendTree.GetChildMotion(i);
                if (childMotion == null)
                {
                    this.CreateEmptySlot(node);
                }
                else if (childMotion is BlendTree)
                {
                    this.CreateNodeFromBlendTreeRecursive(childMotion as BlendTree, node);
                }
                else
                {
                    if (!(childMotion is AnimationClip))
                    {
                        throw new NotImplementedException("Unknown Motion type:" + childMotion.GetType());
                    }
                    this.CreateNodeFromAnimationClip(childMotion as AnimationClip, node);
                }
            }
        }