public PlayingAnimationCondition(AnimationSet animations, AnimationKey key, int frameMin, int frameMax)
 {
     Animations = animations;
     Key        = key;
     FrameMin   = frameMin;
     FrameMax   = frameMax;
 }
示例#2
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);
        }
示例#3
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()));
        }
示例#4
0
 public bool IsPlaying(AnimationKey key)
 {
     return(CurrentKey.Name == key.Name && !CurrentAnimation.Finished);
 }
示例#5
0
 public AnimationControlledHitbox(IWorldObject owner, AnimationSet animations, AnimationKey key, int frameMin, int frameMax)
     : base(new PlayingAnimationCondition(animations, key, frameMin, frameMax), owner)
 {
 }
 public static Condition IsAnimationPlaying(this AnimationSet animation, AnimationKey key)
 {
     return(new PlayingAnimationCondition(animation, key));
 }
 public PlayingAnimationCondition(AnimationSet animations, AnimationKey key) : this(animations, key, 0, 9999)
 {
 }