Ejemplo n.º 1
0
 public void PlayUvAnimation(SimpleUvAnimation anim)
 {
     /* For each animation target */
     for (int x = 0; x < anim.UvShellTargetCount; ++x)
     {
         mAvatarFaceMesh.Play(anim.GetUvShellTarget(x), anim.GetFrameSequence(x));
     }
 }
Ejemplo n.º 2
0
        private ComplexUvAnimation ParseComplexUvAnimation(XmlNode complexUvAnimationXmlNode)
        {
            string      name = XmlUtility.GetStringAttribute(complexUvAnimationXmlNode, "name");
            XmlNodeList complexFrameNodes = complexUvAnimationXmlNode.SelectNodes("ComplexFrame");

            if (complexFrameNodes.Count == 0)
            {
                Console.LogError("ComplexUvAnimation " + name + " does not have any ComplexFrames defined in node: " + complexUvAnimationXmlNode.OuterXml);
                return(null);
            }

            ComplexFrame[] frames = new ComplexFrame[complexFrameNodes.Count];

            /* Foreach ComplexFrame */
            int complexFrameCount = 0;

            foreach (XmlNode complexFrameNode in complexFrameNodes)
            {
                int   repeatFrame       = XmlUtility.GetIntAttribute(complexFrameNode, "repeatFrame");
                float waitAfterFinished = XmlUtility.GetFloatAttribute(complexFrameNode, "waitAfterFinished");

                XmlNodeList simpleAnimationNodes = complexFrameNode.SelectNodes("SimpleAnimation");
                if (simpleAnimationNodes.Count == 0)
                {
                    Console.LogError("ComplexFrame does not have any Simple animations defined in name: " + complexFrameNode.OuterXml);
                    return(null);
                }

                /* Foreach Animation Frame */
                List <SimpleUvAnimation> simpleAnimations = new List <SimpleUvAnimation>();
                foreach (XmlNode simpleAnimation in simpleAnimationNodes)
                {
                    string      uvAnimationId = XmlUtility.GetStringAttribute(simpleAnimation, "assetId");
                    UvAnimation uvAnimation;
                    if (mUvAnimationLookUpTable.TryGetValue(uvAnimationId, out uvAnimation))
                    {
                        SimpleUvAnimation simpleUvAnimation = (SimpleUvAnimation)uvAnimation;
                        if (simpleUvAnimation == null)
                        {
                            Console.Log("Could not assign uvAnimation as SimpleAnimation from key: " + uvAnimationId);
                        }
                        else
                        {
                            simpleAnimations.Add(simpleUvAnimation);
                        }
                    }
                    else
                    {
                        Console.LogError("Unable to pull simple uv animation from dictionary using key: " + uvAnimationId);
                    }
                }
                frames[complexFrameCount] = new ComplexFrame(repeatFrame, waitAfterFinished, simpleAnimations.ToArray());
                ++complexFrameCount;
            }

            return(new ComplexUvAnimation(name, frames));
        }
Ejemplo n.º 3
0
 private void SetupSimpleUvAnimations(XmlNode rootNode)
 {
     /* foreach ComplexUvAnimation Range */
     foreach (XmlNode uvAnimationNode in rootNode.SelectNodes("descendant::SimpleUvAnimation"))
     {
         SimpleUvAnimation newUva        = SimpleUvAnimation.Parse(uvAnimationNode);
         string            uvAnimationId = XmlUtility.GetStringAttribute(uvAnimationNode, "assetId");
         mUvAnimationLookUpTable.Add(uvAnimationId, newUva);
     }
 }
Ejemplo n.º 4
0
 private void PlayAnimation(UvAnimation animation)
 {
     if (animation is SimpleUvAnimation)
     {
         mComplexUvAnimator.StopAnimation();
         SimpleUvAnimation simpleUvAnimation = (SimpleUvAnimation)animation;
         mComplexUvAnimator.PlayUvAnimation(simpleUvAnimation);
     }
     else if (animation is ComplexUvAnimation)
     {
         mComplexUvAnimator.StopAnimation();
         ComplexUvAnimation complexUvAnimation = (ComplexUvAnimation)animation;
         mScheduler.StartCoroutine(mComplexUvAnimator.PlayComplexAnimation(complexUvAnimation));
     }
     else
     {
         Console.LogError("UvAnimation being passed into PlayAnimation is neither a SimpleUvAnimation or ComplexUvAnimation type");
     }
 }
Ejemplo n.º 5
0
 public UvAnimationAsset(AssetSubType type, SimpleUvAnimation animation, string displayName, string path, string key)
     : base(type, displayName, path, key)
 {
     mAnimation = animation;
 }