Esempio n. 1
0
 public void AddAnimation(string id, FrameList frames)
 {
     if (!_animations.ContainsKey(id))
     {
         _animations.Add(id, frames);
     }
 }
Esempio n. 2
0
        public void Update()
        {
            if (_nextAnimation != CurrentAnimationId)
            {
                CurrentAnimation = _animations[_nextAnimation];

                Texture       = CurrentAnimation.CurrentFrame.Texture;
                TextureOffset = CurrentAnimation.CurrentFrame.TextureOffset;
                TextureClip   = CurrentAnimation.CurrentFrame.TextureClip;
                Hitbox        = CurrentAnimation.CurrentFrame.Hitbox;
            }

            if (CurrentAnimation == null)
            {
                return;
            }

            CurrentAnimation.Update();

            if (!CurrentAnimation.Changed)
            {
                return;
            }

            Texture       = CurrentAnimation.CurrentFrame.Texture;
            TextureOffset = CurrentAnimation.CurrentFrame.TextureOffset;
            TextureClip   = CurrentAnimation.CurrentFrame.TextureClip;
            Hitbox        = CurrentAnimation.CurrentFrame.Hitbox;
        }