public void AddAnimation(String key, Animation animation)
 {
     Animation anim;
     if (AnimationSet.TryGetValue(key, out anim))
     {
         // TODO: make an error message or something
     }
     else
     {
         AnimationSet.Add(key, animation);
     }
 }
 public void AddFrame(String key, Texture texture, IntRect subImageRect)
 {
     Animation anim;
     if(AnimationSet.TryGetValue(key, out anim))
     {
         anim.AddFrame(texture, subImageRect);
     }
     else
     {
         anim = new Animation();
         anim.AddFrame(texture, subImageRect);
         AnimationSet.Add(key, anim);
     }
 }
 public AnimationRenderComponent(Animation animation, RenderManager renderMgr, GameObject parent)
     : base(renderMgr, parent)
 {
     Animation = animation;
 }
 public AnimationRenderComponent(RenderManager renderMgr, GameObject parent)
     : base(renderMgr, parent)
 {
     Animation = new Animation();
 }
예제 #5
0
        // clones the animation, but resets all of the timers.
        public Animation CloneFrames()
        {
            Animation anim = new Animation();
            anim.Frames = Frames;
            anim.FrameTime = FrameTime;
            anim.IsLooping = IsLooping;

            return anim;
        }
        public void SetAnimation(String key)
        {
            Animation anim;

            if (key == CurrentKey)
                return;

            if (AnimationSet.TryGetValue(key, out anim))
            {
                CurrentKey = key;
                CurrentAnimation = anim;
                CurrentAnimation.Reset();

            }
            else
            {
                //TODO: thow an exception or something...
            }
        }
예제 #7
0
 static Animation GetAnimation(String filename)
 {
     if (Animations.ContainsKey(filename))
     {
         return Animations[filename].CloneFrames();
     }
     else
     {
         Animation anim = new Animation(filename);
         Animations.Add(filename, anim);
         return anim;
     }
 }