Пример #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            AnimationStrip strip = Animations[PlayingAnimation];

            spriteBatch.Draw(
                strip.Frames[strip.CurrentFrame].Texture,
                ScreenPosition,
                strip.Frames[strip.CurrentFrame].SourceRectangle,
                TintColor,
                Rotation,
                RelativeCenter,
                Scale,
                SpriteEffect,
                LayerDepth);
        }
Пример #2
0
        public void Invalidate(AnimationStripSettings settings, Action <AnimationStripSettings> saveCallback)
        {
            animation = new AnimationStrip(settings);
            var analyzer = new AnimationStripAnalyzer(settings);

            frames = analyzer.Frames.ToList();
            LoadFrameTexture(settings.FrameWidth, settings.FrameHeight);
            LoadSolidTexture(settings.FrameWidth, settings.FrameHeight);

            Width       = analyzer.Width + margin;
            Height      = analyzer.Height + margin;
            coordinates = new CoordinateViewer(graphicsDevice, MColor.Black, (int)Width, (int)Height);
            cameraHandler.UpdateViewport((int)Width, (int)Height);
            ReDraw();

            if (saveCallback != null)
            {
                Save(settings, saveCallback);
            }
        }
Пример #3
0
 public void SetAnimation(string name, Texture2D texture, Rectangle initialFrame, int frameCount, float fps)
 {
     Animations[name] = new AnimationStrip(texture, initialFrame, frameCount, fps);
 }