public Animation Add <T>(AnimationKey key, T gameObject, TextureFlipBehavior flipBehavior, params int[] frames) where T : IRemoveable, IWithPositionAndDirection, IWithSprite { var anim = new DirectedAnimation(gameObject, gameObject, gameObject.Sprite, flipBehavior, frames); Add(key.Name, anim); return(anim); }
public Animation AddRange <T>(AnimationKey key, T gameObject, TextureFlipBehavior flipBehavior, int from, int to, int holdFrame = -1, int holdFor = 2) where T : IRemoveable, IWithPositionAndDirection, IWithSprite { List <int> frames = Enumerable.Range(from, (to - from)).ToList(); if (holdFrame > -1) { frames = frames.SelectMany(p => (p == holdFrame) ? Enumerable.Range(0, holdFor).Select(q => p) : new int[] { p }).ToList(); } return(Add(key, gameObject, flipBehavior, frames.ToArray())); }
public DirectedAnimation(IRemoveable root, IWithPositionAndDirection parent, Sprite sprite, TextureFlipBehavior flipbehavior, params int[] frames) : base(root, parent, sprite, frames) { Parent = parent; FlipBehavior = flipbehavior; }