Beispiel #1
0
        public override void Update(TimeSpan time)
        {
            if (Parent != null && Parent.RenderComponent is CharacterRenderer characterRenderer)
            {
                characterRenderer.Skeleton.UpdateScripts(time);
                return;
            }
            totalTime += time.TotalSeconds;
            int c = animations.Count;

            for (int i = animations.Count - 1; i >= 0; i--)
            {
                if (ProcessAnimation(animations[i]))
                {
                    if (AnimationCompleted != null)
                    {
                        AnimationCompleted(animations[i].Name);
                    }
                    animations.RemoveAt(i);
                }
            }
            if (c > 0 && Parent != null)
            {
                Parent.RigidModel.UpdateTransform();
                Parent.UpdateCollision();
            }
            if (c > 0)
            {
                rm?.UpdateTransform();
            }
        }
Beispiel #2
0
 public void ResetAnimations()
 {
     animations.Clear();
     if (Parent != null)
     {
         foreach (var p in Parent.RigidModel.AllParts)
         {
             p.Construct?.Reset();
         }
         Parent.RigidModel.UpdateTransform();
     }
     else if (rm != null)
     {
         foreach (var p in rm.AllParts)
         {
             p.Construct?.Reset();
         }
         rm.UpdateTransform();
     }
 }