Esempio n. 1
0
        public static Explosion GetExplosion()
        {
            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();
            Animation animation = new Animation(16, 64, 64, 0, 0);
            animation.FramesPerSecond = 20;
            animations.Add(AnimationKey.Down, animation);

            Explosion explosion = new Explosion(ExplosionTexture, animations);

            return explosion;
        }
Esempio n. 2
0
        public void Animate()
        {
            Animation anim = new Animation(2, 32, 32, 0, 0);
            anim.FramesPerSecond = 60;

            Rectangle frame1 = anim.CurrentFrameRect;
            anim.Update();
            Rectangle frame2 = anim.CurrentFrameRect;

            Assert.That(frame1, Is.Not.EqualTo(frame2));
        }
Esempio n. 3
0
        public void FPSCalculation()
        {
            Animation anim = new Animation(2, 32, 32, 0, 0);
            //30 FPS = New frame every other update
            anim.FramesPerSecond = 30;

            int frame = anim.CurrentFrame;
            anim.Update();
            Assert.That(anim.CurrentFrame, Is.EqualTo(frame));
            anim.Update();
            Assert.That(anim.CurrentFrame, Is.Not.EqualTo(frame));
        }
Esempio n. 4
0
        public static Character GetCharacter()
        {
            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();
            Animation animation = new Animation(3, 32, 32, 0, 0);
            animations.Add(AnimationKey.Down, animation);
            animation = new Animation(3, 32, 32, 0, 32);
            animations.Add(AnimationKey.Left, animation);
            animation = new Animation(3, 32, 32, 0, 64);
            animations.Add(AnimationKey.Right, animation);
            animation = new Animation(3, 32, 32, 0, 96);
            animations.Add(AnimationKey.Up, animation);
            Character character = new Character(SceneGraph, CharacterTexture, animations);
            character.AI = new PlayerAI();
            character.SetCollisionSize(32, 32);

            return character;
        }
Esempio n. 5
0
        public void Clone()
        {
            Animation anim = new Animation(2, 32, 32, 0, 0);
            anim.FramesPerSecond = 60;

            anim.Update();
            anim.Update();
            anim.Update();

            Animation clone = (Animation)anim.Clone();

            Assert.That(
                (anim.CurrentFrame == clone.CurrentFrame) &&
                (anim.CurrentFrameRect == clone.CurrentFrameRect) &&
                (anim.FrameHeight == clone.FrameHeight) &&
                (anim.FramesPerSecond == clone.FramesPerSecond) &&
                (anim.FrameWidth == clone.FrameWidth) &&
                (anim.Looped == clone.Looped),
                "Clone did not produce a copy of the Animation.");

            Assert.AreNotSame(anim, clone, "Clone produced a reference copy of the Animation.");
        }
Esempio n. 6
0
        public static Fireball GetFireBall()
        {
            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();
            Animation animation = new Animation(3, 32, 32, 0, 0);
            animations.Add(AnimationKey.Down, animation);
            animation = new Animation(3, 32, 32, 0, 32);
            animations.Add(AnimationKey.Left, animation);
            animation = new Animation(3, 32, 32, 0, 64);
            animations.Add(AnimationKey.Right, animation);
            animation = new Animation(3, 32, 32, 0, 96);
            animations.Add(AnimationKey.Up, animation);
            Fireball fireBall = new Fireball(SceneGraph, FireBallTexture, animations);
            fireBall.SetCollisionSize(32, 32);

            return fireBall;
        }
Esempio n. 7
0
 public void FPS_ValidValues(int fps)
 {
     Animation anim = new Animation(2, 32, 32, 0, 0);
     anim.FramesPerSecond = fps;
 }
Esempio n. 8
0
 public void Default5FPS()
 {
     Animation anim = new Animation(2, 32, 32, 0, 0);
     Assert.That(anim.FramesPerSecond == 5);
 }
Esempio n. 9
0
        public void Reset()
        {
            Animation anim = new Animation(2, 32, 32, 0, 0);
            anim.FramesPerSecond = 60;
            Rectangle frame1 = anim.CurrentFrameRect;
            anim.Update();
            anim.Reset();
            Rectangle resetFrame = anim.CurrentFrameRect;

            Assert.That(frame1, Is.EqualTo(resetFrame));
        }
Esempio n. 10
0
        //TODO: Evaluate necesity of the cloning
        public object Clone()
        {
            Animation animationClone = new Animation(this);
            animationClone._CurrentFrame = this._CurrentFrame;
            animationClone.FramesPerSecond = this._FramesPerSecond;
            animationClone._FrameWidth = this._FrameWidth;
            animationClone._FrameHeight = this._FrameHeight;
            animationClone._FramesPerSecond = this._FramesPerSecond;
            animationClone.Looped = this.Looped;

            return animationClone;
        }
Esempio n. 11
0
 private Animation(Animation animation)
 {
     this._Frames = animation._Frames;
 }