Exemple #1
0
        /// <summary>
        /// 绘制动画当前帧
        /// </summary>
        /// <returns>是否正常绘制</returns>
        public bool Draw(Sprite sprite, Vector3 pos)
        {
            AnimationFrame aniFrame = currentFrame;

            sprite.Draw(texture, aniFrame.ClipRect, aniFrame.FrameOffset, pos, Color.White.ToArgb());
            return(true);
        }
		/// <summary>
		/// 新建动画
		/// </summary>
		/// <param name="texture">动画用贴图</param>
		/// <param name="ltFrames">动画所有帧信息的链表</param>
		public Animation(Texture texture, LinkedList<AnimationFrame> ltFrames)
		{
			this.texture = texture;
			this.allAniFrames = ltFrames;
			this.currentFrame = allAniFrames.First == null ? null : allAniFrames.First.Value;
			this.isPlaying = false;
			this.isLoop = false;
			this.isFinished = true;
		}
Exemple #3
0
 /// <summary>
 /// 新建动画
 /// </summary>
 /// <param name="texture">动画用贴图</param>
 /// <param name="ltFrames">动画所有帧信息的链表</param>
 public Animation(Texture texture, LinkedList <AnimationFrame> ltFrames)
 {
     this.texture      = texture;
     this.allAniFrames = ltFrames;
     this.currentFrame = allAniFrames.First == null ? null : allAniFrames.First.Value;
     this.isPlaying    = false;
     this.isLoop       = false;
     this.isFinished   = true;
 }
Exemple #4
0
        private void DisplayCallBack(int n)
        {
            LinkedListNode <AnimationFrame> node = allAniFrames.Find(currentFrame).Next;

            if (node != null)
            {
                currentFrame = node.Value;
            }
            else if (isLoop)
            {
                currentFrame = allAniFrames.First.Value;
            }
            else
            {
                isFinished = true;
                TimerUtils.Stop(this.GetHashCode().ToString());
            }
        }
		private void DisplayCallBack(int n)
		{
			LinkedListNode<AnimationFrame> node = allAniFrames.Find(currentFrame).Next;
			
			if (node != null)
			{
				currentFrame = node.Value;
			}
			else if(isLoop)
			{
				currentFrame = allAniFrames.First.Value;
			}
			else
			{
				isFinished = true;
				TimerUtils.Stop(this.GetHashCode().ToString());
			}
			
		}