Beispiel #1
0
        public SimpleAnimation(BinaryReader BR, ContentManager Content, string TexturePathPrefix)
            : this()
        {
            IsAnimated = BR.ReadBoolean();
            Name       = BR.ReadString();
            Path       = BR.ReadString();

            if (IsAnimated)
            {
                ActiveAnimation         = new AnimationLooped(Path);
                ActiveAnimation.Content = Content;
                foreach (KeyValuePair <string, Timeline> Timeline in AnimationClass.LoadAllTimelines())
                {
                    ActiveAnimation.DicTimeline.Add(Timeline.Key, Timeline.Value);
                }
                ActiveAnimation.Load();
            }
            else
            {
                if (Path.Contains("strip"))
                {
                    ActualSprite = new AnimatedSprite(Content, Path, Vector2.Zero);
                }
                else
                {
                    StaticSprite = Content.Load <Texture2D>(TexturePathPrefix + Path);
                }

                Rectangle Size = PositionRectangle;
                Origin = new Vector2(Size.Width / 2, Size.Height / 2);
            }
        }
Beispiel #2
0
        public void Load(ContentManager Content, string TexturePathPrefix)
        {
            if (IsAnimated)
            {
                ActiveAnimation         = new AnimationLooped(Path);
                ActiveAnimation.Content = Content;
                foreach (KeyValuePair <string, Timeline> Timeline in AnimationClass.LoadAllTimelines())
                {
                    ActiveAnimation.DicTimeline.Add(Timeline.Key, Timeline.Value);
                }
                ActiveAnimation.Load();
            }
            else
            {
                if (Path.Contains("strip"))
                {
                    ActualSprite = new AnimatedSprite(Content, "Animations/Sprites/" + Path, Vector2.Zero);
                }
                else
                {
                    StaticSprite = Content.Load <Texture2D>(TexturePathPrefix + Path);
                }
            }

            Rectangle Size = PositionRectangle;

            Origin = new Vector2(Size.Width / 2, Size.Height / 2);
        }