Exemplo n.º 1
0
        /// <summary>
        /// Goes to the next frame (does nothinf if it was last frame).
        /// </summary>
        public static IFrameAnimable GotoNextFrame(this IFrameAnimable target)
        {
            var currentFrame = target.currentFrame;

            if (currentFrame + 1 < target.totalFrames)
            {
                target.currentFrame = currentFrame + 1;
            }

            return(target);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Goes to the previous frame (does nothinf if it was first frame).
        /// </summary>
        public static IFrameAnimable GotoPrevFrame(this IFrameAnimable target)
        {
            var currentFrame = target.currentFrame;

            if (currentFrame > 0)
            {
                target.currentFrame = currentFrame - 1;
            }

            return(target);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Goes to the next frame (jumps to the first frame if it was last frame).
        /// </summary>
        public static IFrameAnimable StepForward(this IFrameAnimable target)
        {
            var currentFrame = target.currentFrame;

            if (currentFrame + 1 < target.totalFrames)
            {
                target.currentFrame = currentFrame + 1;
            }
            else
            {
                target.currentFrame = 0;
            }

            return(target);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Goes to the previous frame (jumps to the last frame if it was first frame).
        /// </summary>
        public static IFrameAnimable StepBackward(this IFrameAnimable target)
        {
            var currentFrame = target.currentFrame;

            if (currentFrame > 0)
            {
                target.currentFrame = currentFrame - 1;
            }
            else
            {
                target.currentFrame = target.totalFrames - 1;
            }

            return(target);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Begin playing from the last frame to the first frame.
 /// PlayCompleted event will be dispatced.
 /// </summary>
 public static void PlayFromEndToBegin(this IFrameAnimable target)
 {
     target.currentFrame = target.totalFrames - 1;
     target.PlayToBegin();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Begin playing from the current frame to the specified frame.
 /// PlayCompleted event will be dispatced.
 /// </summary>
 public static void PlayTo(this IFrameAnimable target, int frameNum)
 {
     target.animation.PlayTo(frameNum);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Begin playing forward from current frame and stop on the last frame.
 /// PlayCompleted event will be dispatced.
 /// </summary>
 public static void PlayToEnd(this IFrameAnimable target)
 {
     target.animation.PlayTo(target.totalFrames - 1);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Begin playing from the first frame to the last frame.
 /// PlayCompleted event will be dispatced.
 /// </summary>
 public static void PlayFromBeginToEnd(this IFrameAnimable target)
 {
     target.currentFrame = 0;
     target.PlayToEnd();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Begin playing backward from current frame.
 /// </summary>
 public static void PlayReverse(this IFrameAnimable target)
 {
     target.animation.PlayLoop(-1);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Begin playing backward from current frame and stop on the first frame.
 /// PlayCompleted event will be dispatced.
 /// </summary>
 public static void PlayToBegin(this IFrameAnimable target)
 {
     target.animation.PlayTo(0);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Goes to the specified frame and starts playing forward.
 /// </summary>
 public static IFrameAnimable GotoAndPlay(this IFrameAnimable target, int frameNum)
 {
     target.currentFrame = frameNum;
     target.Play();
     return(target);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Begin playing forward from current frame.
 /// </summary>
 public static void Play(this IFrameAnimable target)
 {
     target.animation.PlayLoop(1);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Returns true if currentFrame == 0
 /// </summary>
 public static bool IsFirstFrame(this IFrameAnimable target)
 {
     return(target.currentFrame == 0);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Goes to the random frame. Does not stop playing if animation is active.
 /// </summary>
 public static IFrameAnimable GotoRandomFrame(this IFrameAnimable target)
 {
     target.currentFrame = RandomUtil.RandomInt(0, target.totalFrames - 1);
     return(target);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Goes to the first frame. Does not stop playing if animation is active.
 /// </summary>
 public static IFrameAnimable GotoFirstFrame(this IFrameAnimable target)
 {
     target.currentFrame = 0;
     return(target);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Stop animation.
 /// </summary>
 public static void Stop(this IFrameAnimable target)
 {
     target.animation.Stop();
 }
Exemplo n.º 17
0
 /// <summary>
 /// Goes to the last frame. Does not stop playing if animation is active.
 /// </summary>
 public static IFrameAnimable GotoLastFrame(this IFrameAnimable target)
 {
     target.currentFrame = target.totalFrames - 1;
     return(target);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Returns true if currentFrame == totalFrames - 1
 /// </summary>
 public static bool IsLastFrame(this IFrameAnimable target)
 {
     return(target.currentFrame == target.totalFrames - 1);
 }
Exemplo n.º 19
0
 public FrameAnimation(IFrameAnimable target)
 {
     _target = target;
 }