Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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()));
        }
Exemplo n.º 3
0
 public DirectedAnimation(IRemoveable root, IWithPositionAndDirection parent, Sprite sprite, TextureFlipBehavior flipbehavior, params int[] frames)
     : base(root, parent, sprite, frames)
 {
     Parent       = parent;
     FlipBehavior = flipbehavior;
 }