Exemple #1
0
        public void RemoveFrame(int i)
        {
            frames.RemoveAt(i);
            currentData.Frames.RemoveAt(i);

            if (index > frames.Count - 1)
            {
                index = frames.Count - 1;
            }
            if (index < 0)
            {
                index = 0;
            }

            if (frames.Count == 0)
            {
                frame = null;
            }
            else
            {
                frame = frames[index];
            }
        }
Exemple #2
0
        public void Update(GameTime gt)
        {
            Size     = Gui.PrevSize;
            Position = Gui.PrevPos;

            var delta = gt.Delta();

            var list = FramesGui.Instance.frames;

            if (list != null && list.Count > 0)
            {
                if (currentFrame == null)
                {
                    currentFrame = list[0];
                }

                timer += delta;

                if (timer >= currentFrame.FrameSpeed)
                {
                    frame = (frame + 1) % list.Count;
                    timer = 0;
                }

                if (frame >= list.Count)
                {
                    frame = 0;
                }

                currentFrame = list[frame];
            }
            else
            {
                currentFrame = null;
            }
        }