コード例 #1
0
 public void AddFrameAnimation(string name, int fps, FrameSet set, bool loop)
 {
     if (_frameAnimations.ContainsKey(name))
     {
         throw new ArgumentException(string.Format("Frame Animation {0} Already Exists", name));
     }
     FrameAnimation anim = new FrameAnimation(name, _manager)
     {
         AnimationFrameSet = set,
         FramesPerSecond = fps,
         Duration = (float)(set.Count) / (float)(fps),
         Loop = loop,
         RepeatCount = loop ? int.MaxValue : 0,
         Apply = (v) =>
         {
             if (v != null)
             {
                 _frame.SourceRectangle = v.SourceRectangle;
                 _frame.Center = v.Center;
             }
         }, // the most important part
     };
     _frameAnimations.Add(name, anim);
 }
コード例 #2
0
 // Frame Set format needs to be {AnimationName}_{FrameIndex} for this to work
 public void AddFrameAnimation(string name, int fps, FrameSet set)
 {
     AddFrameAnimation(name, fps, set, true);
 }