public List <Animation> GetAnimations(CharacterMode mode)
 {
     return
         (OrientationStrings.Where((t, i) => HasAnimation(mode, (Orientation)i))
          .Select(t => Animations[mode.ToString() + t])
          .ToList());
 }
        public static Animation CreateAnimation(CharacterMode mode,
                                                Orientation orient,
                                                SpriteSheet texture,
                                                float frameHz,
                                                int frameWidth,
                                                int frameHeight,
                                                int row,
                                                List <int> cols)
        {
            List <Point> frames  = new List <Point>();
            int          numCols = texture.Width / frameWidth;

            if (cols.Count == 0)
            {
                for (int i = 0; i < numCols; i++)
                {
                    frames.Add(new Point(i, row));
                }
            }
            else
            {
                frames.AddRange(cols.Select(c => new Point(c, row)));
            }

            return(new Animation(GameState.Game.GraphicsDevice, texture, mode.ToString() + OrientationStrings[(int)orient], frameWidth, frameHeight, frames, true, Color.White, frameHz, (float)frameWidth / 35.0f, (float)frameHeight / 35.0f, false));
        }
 public void ReloopAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString(), true);
     if (AnimPlayer.IsDone())
     {
         AnimPlayer.Reset();
     }
 }
 public void ReloopAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString() + OrientationStrings[(int)CurrentOrientation]);
     if (AnimPlayer.IsDone())
     {
         AnimPlayer.Reset();
     }
 }
        public void AddAnimation(CharacterMode mode,
                                 Orientation orient,
                                 SpriteSheet texture,
                                 float frameHz,
                                 int frameWidth,
                                 int frameHeight,
                                 int row,
                                 params int[] cols)
        {
            List <int> ints = new List <int>();

            ints.AddRange(cols);
            Animation animation = CreateAnimation(mode, orient, texture, frameHz, frameWidth, frameHeight, row, ints);

            Animations[mode.ToString() + OrientationStrings[(int)orient]] = animation;
            animation.Play();
        }
 public bool HasAnimation(CharacterMode mode, Orientation orient)
 {
     return(Animations.ContainsKey(mode.ToString() + OrientationStrings[(int)orient]));
 }
 public void ResetAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString());
     AnimPlayer.Reset();
 }
 public void ResetAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString() + OrientationStrings[(int)CurrentOrientation]);
     AnimPlayer.Reset();
 }
Exemple #9
0
 public void SetCharacterMode(CharacterMode mode)
 {
     currentMode = mode;
     Debug.Log(playerData.characterID + " " + mode.ToString());
 }