public AnimationContainer(string name) { string file = Content.ContentInterface.LoadFile("animations/"+name); if (string.IsNullOrEmpty(file)) { _texture = Content.ContentInterface.DefaultTexture; _animation = new Animation(0, 0, 0, new int[] { 0 }); return; } string[] lines = file.Split(new string[]{"\n", Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); _texture = Content.ContentInterface.LoadTexture(lines[0]); string[] frameStrings = lines[1].Split(' '); int timeDiff; int.TryParse(frameStrings[0],out timeDiff); int[] frames = new int[frameStrings.Length-1]; for (int x = 1; x < frameStrings.Length; x++) { int.TryParse(frameStrings[x], out frames[x-1]); } _animation = new Animation(timeDiff, _texture.Height, _texture.Height, frames); _size = new Vector2(_texture.Height, _texture.Height); }
public AnimationContainer(Texture2D texture, Animation animation) { _animation = animation; _texture = texture; _size = new Vector2(_texture.Height, _texture.Height); }
public void AddAnimation(Animation ani) { _extraAnimations.Add(ani); }
public void SetAnimation(bool force, int extraID) { if (force && _extraAnimations.Count > extraID) { keepAni = force; currentAnimation = _extraAnimations[extraID]; } else { keepAni = false; } }
void SetAnimation(Animation animation) { if (currentAnimation != animation) { if (currentAnimation != null) currentAnimation.SetFrame(0); currentAnimation = animation; } }