示例#1
0
文件: Animation.cs 项目: MyEyes/Igorr
 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);
 }
示例#2
0
文件: Animation.cs 项目: MyEyes/Igorr
 public AnimationContainer(Texture2D texture, Animation animation)
 {
     _animation = animation;
     _texture = texture;
     _size = new Vector2(_texture.Height, _texture.Height);
 }
示例#3
0
 public void AddAnimation(Animation ani)
 {
     _extraAnimations.Add(ani);
 }
示例#4
0
 public void SetAnimation(bool force, int extraID)
 {
     if (force && _extraAnimations.Count > extraID)
     {
         keepAni = force;
         currentAnimation = _extraAnimations[extraID];
     }
     else
     {
         keepAni = false;
     }
 }
示例#5
0
 void SetAnimation(Animation animation)
 {
     if (currentAnimation != animation)
     {
         if (currentAnimation != null)
             currentAnimation.SetFrame(0);
         currentAnimation = animation;
     }
 }