Beispiel #1
0
        public void SetFrameSetQueue(FrameSet[] indexes, bool clearQueue = true)
        {
            if (indexes.Length == 0)
            {
                throw new ArgumentOutOfRangeException("indexes");
            }
            if (clearQueue)
            {
                frameSetQueue.Clear();
            }
            foreach (FrameSet set in indexes)
            {
                frameSetQueue.Enqueue(set);
            }
            FrameSet next = frameSetQueue.Dequeue();

            SetFrameSet(next);
        }
Beispiel #2
0
        public void SetFrameSet(FrameSet set, bool allowRedundancy = false)
        {
            if (set == null)
            {
                throw new ArgumentNullException("set");
            }

            if (!allowRedundancy && frameSet == set)             // avoid redundancy.
            {
                return;
            }

            frameSet = set;
            frame    = set.Start;

            elapsed = TimeSpan.Zero;
            signaledAnimationCompleted = false;
        }
Beispiel #3
0
        public override void UpdateOutput(GameTime gameTime)
        {
            elapsed += gameTime.ElapsedGameTime;

            if (elapsed >= frameSet.Interval)
            {
                frame++;
                elapsed = TimeSpan.Zero;
            }

            if (frame > frameSet.Length - 1)
            {
                if (frameSetQueue.Count != 0)
                {
                    FrameSet next = frameSetQueue.Dequeue();
                    SetFrameSet(next);
                }
                else if (frameSet.Loop)
                {
                    frame = frameSet.Start;
                }
                else
                {
                    frame--;                     // stay on last frame.

                    if (!signaledAnimationCompleted)
                    {
                        signaledAnimationCompleted = true;

                        InvokeAnimationComplete(new AnimationCompleteArgs
                        {
                            FrameSet = frameSet,
                            GameTime = gameTime
                        });
                    }
                }
            }

            base.UpdateOutput(gameTime);
        }
Beispiel #4
0
        public void SetFrameSet(FrameSet set, bool allowRedundancy = false)
        {
            if (set == null)
            {
                throw new ArgumentNullException("set");
            }

            if (!allowRedundancy && frameSet == set) // avoid redundancy.
            {
                return;
            }

            frameSet = set;
            frame = set.Start;

            elapsed = TimeSpan.Zero;
            signaledAnimationCompleted = false;
        }
Beispiel #5
0
 public void SetFrameSetQueue(FrameSet[] indexes, bool clearQueue = true)
 {
     if (indexes.Length == 0)
     {
         throw new ArgumentOutOfRangeException("indexes");
     }
     if (clearQueue)
     {
         frameSetQueue.Clear();
     }
     foreach (FrameSet set in indexes)
     {
         frameSetQueue.Enqueue(set);
     }
     FrameSet next = frameSetQueue.Dequeue();
     SetFrameSet(next);
 }