public IAnimationConfiguration ToItem(AGSSerializationContext context)
        {
            AGSAnimationConfiguration config = new AGSAnimationConfiguration();

            config.Loops   = Loops;
            config.Looping = Looping;
            return(config);
        }
Пример #2
0
		public void SetupAnimationTest(LoopingStyle looping, int expectedFrame, bool expectedBackwards)
		{
            AGSAnimationConfiguration config = new AGSAnimationConfiguration { Looping = looping, DelayBetweenFrames = 0 };
			AGSAnimationState state = new AGSAnimationState ();
			AGSAnimation animation = new AGSAnimation (config, state);
			for (int i = 0; i < 5; i++)
			{
				animation.Frames.Add(getFrame(i * 2));
			}

			animation.Setup();

			Assert.AreEqual(expectedFrame, state.CurrentFrame);
			Assert.AreEqual(0, state.CurrentLoop);
			Assert.AreEqual(expectedBackwards, state.RunningBackwards);
			Assert.AreEqual(expectedFrame * 2, state.TimeToNextFrame);
		}
Пример #3
0
		public void NextFrameTest(LoopingStyle looping, int loops, int currentFrame, int currentLoop, bool runningBackwards, int expectedFrame, int expectedLoop, bool expectedBackwards)
		{
            AGSAnimationConfiguration config = new AGSAnimationConfiguration { Looping = looping, Loops = loops, DelayBetweenFrames = 0 };
			AGSAnimationState state = new AGSAnimationState {
				CurrentFrame = currentFrame,
				CurrentLoop = currentLoop,
				RunningBackwards = runningBackwards,
				TimeToNextFrame = currentFrame * 2
			};
			AGSAnimation animation = new AGSAnimation (config, state);
			for (int i = 0; i < 5; i++)
			{
				animation.Frames.Add(getFrame(i * 2));
			}

			animation.NextFrame();

			Assert.AreEqual(expectedFrame, state.CurrentFrame);
			Assert.AreEqual(expectedLoop, state.CurrentLoop);
			Assert.AreEqual(expectedBackwards, state.RunningBackwards);
			Assert.AreEqual(expectedFrame * 2, state.TimeToNextFrame);
		}