public bool HasAnimation(Creature.CharacterMode mode, Orientation orient) { return Animations.ContainsKey(mode.ToString() + OrientationStrings[(int) orient]); }
public List<Animation> GetAnimations(Creature.CharacterMode mode) { return OrientationStrings.Where((t, i) => HasAnimation(mode, (Orientation) i)) .Select(t => Animations[mode.ToString() + t]) .ToList(); }
public Animation GetAnimation(Creature.CharacterMode mode, Orientation orient) { if (HasAnimation(mode, orient)) { return Animations[mode.ToString() + OrientationStrings[(int) orient]]; } else { return null; } }
public void AddAnimation(Creature.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 static CompositeAnimation CreateCompositeAnimation(Creature.CharacterMode mode, Orientation orient, string composite, float frameHz, List<SpriteSheet> layers, List<Color> tints, params int[][] frames ) { return new CompositeAnimation(composite, layers, tints, frames) { FrameHZ = frameHz, Name = mode.ToString() + OrientationStrings[(int) orient], Loops = true, CurrentFrame = 0 }; }
public static Animation CreateAnimation(Creature.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); }