示例#1
0
        public void AddAnimation(Animation NewAnimation)
        {
            if (animationList.Count == 0)
            {
                currentCol = NewAnimation.StartCol;
                currentRow = NewAnimation.StartRow;
                currentTime = 0;
            }

            if (!animationList.Contains(NewAnimation))
                animationList.Add(NewAnimation);
        }
示例#2
0
        public Animator(int FrameWidth, int FrameHeight)
        {
            animationList = new List<Animation>();
            activeAnimation = null;
            animating = false;

            frameWidth = FrameWidth;
            frameHeight = FrameHeight;
            currentCol = 0;
            currentRow = 0;

            sourceRect = new Rectangle(0, 0, frameWidth, frameHeight);
            currentTime = 0;
        }
示例#3
0
 public void StartAnimation(string Animation)
 {
     if (activeAnimation == null)
     {
         foreach (Animation Anim in animationList)
         {
             if (Anim.Name == Animation)
             {
                 activeAnimation = Anim;
                 currentCol = activeAnimation.StartCol;
                 currentRow = activeAnimation.StartRow;
                 animating = true;
                 return;
             }
         }
     }
 }
示例#4
0
        public void StopAnimation()
        {
            if (activeAnimation != null)
            {
                animating = false;
                currentCol = activeAnimation.StartCol;
                currentRow = activeAnimation.StartRow;
                currentTime = 0;

                UpdateSourceRect();

                activeAnimation = null;
            }
        }
示例#5
0
 public void StartAnimation(string Animation)
 {
     if (activeAnimation == null)
     {
         foreach (Animation Anim in animationList)
         {
             if (Anim.Name == Animation)
             {
                 Console.WriteLine("STARTED ANIMATION: " + Animation);
                 activeAnimation = Anim;
                 currentCol = activeAnimation.StartCol;
                 currentRow = activeAnimation.StartRow;
                 animating = true;
                 return;
             }
         }
     }
 }
示例#6
0
 public void ResetPrevAnimation()
 {
     prevAnimation = null;
 }
示例#7
0
        public void StopAnimation(String AnimationName)
        {
            if (activeAnimation != null)
            {
                if(activeAnimation.Name == AnimationName)
                {
                    animating = false;
                    currentCol = activeAnimation.StartCol;
                    currentRow = activeAnimation.StartRow;
                    currentTime = 0;

                    UpdateSourceRect();

                    prevAnimation = activeAnimation;
                    activeAnimation = null;
                }
            }
        }
示例#8
0
        public void StopAnimation()
        {
            if (activeAnimation != null)
            {
                animating = false;
                currentCol = activeAnimation.StartCol;
                currentRow = activeAnimation.StartRow;
                currentTime = 0;

                UpdateSourceRect();
                Console.WriteLine("STOPPED ANIMATION: " + activeAnimation.Name);
                prevAnimation = activeAnimation;
                activeAnimation = null;
            }
        }