Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public SimpleAnimation(string Name, string Path, AnimationLooped ActiveAnimation)
     : this()
 {
     this.Name            = Name;
     this.Path            = Path;
     IsAnimated           = true;
     this.ActiveAnimation = ActiveAnimation;
 }
Ejemplo n.º 4
0
        public override AnimationClass Copy()
        {
            AnimationLooped NewAnimationClass = new AnimationLooped(AnimationPath);

            NewAnimationClass.UpdateFrom(this);

            return(NewAnimationClass);
        }
Ejemplo n.º 5
0
 public SimpleAnimation()
 {
     Name            = string.Empty;
     IsAnimated      = false;
     Path            = string.Empty;
     StaticSprite    = null;
     ActualSprite    = null;
     ActiveAnimation = null;
     Position        = Vector2.Zero;
     Origin          = Vector2.Zero;
     Scale           = Vector2.One;
     Depth           = 0;
     Angle           = 0;
     IsLooped        = true;
     HasEnded        = false;
 }
Ejemplo n.º 6
0
        public SimpleAnimation(SimpleAnimation Copy)
        {
            IsAnimated = Copy.IsAnimated;
            Name       = Copy.Name;
            Path       = Copy.Path;

            if (Copy.IsAnimated)
            {
                ActiveAnimation             = new AnimationLooped(Copy.Path);
                ActiveAnimation.Content     = Copy.ActiveAnimation.Content;
                ActiveAnimation.DicTimeline = Copy.ActiveAnimation.DicTimeline;
                ActiveAnimation.Load();
                ActiveAnimation.UpdateKeyFrame(0);
            }
            else
            {
                StaticSprite = Copy.StaticSprite;
            }
        }