Esempio n. 1
0
        public void Resume_Pipeline_Resumed()
        {
            var animation = Substitute.For <IAnimation <Transform> >();
            var pipeline  = AnimationPipeline <Transform> .Create(animation);

            var target = new AnimationPipelineController <Transform>(pipeline);

            target.Resume();

            animation.Received().Resume();
        }
Esempio n. 2
0
        public void DestroyAll_Animations_Resumed()
        {
            var c1 = Substitute.For <IAnimationPipelineController>();
            var c2 = Substitute.For <IAnimationPipelineController>();

            AnimationPipelineController.AddController(c1);
            AnimationPipelineController.AddController(c2);

            AnimationPipelineController.DestroyAll();

            c1.Received().Destroy();
            c2.Received().Destroy();
        }
Esempio n. 3
0
        public void PauseAll_Animations_Paused()
        {
            var c1 = Substitute.For <IAnimationPipelineController> ();
            var c2 = Substitute.For <IAnimationPipelineController>();

            AnimationPipelineController.AddController(c1);
            AnimationPipelineController.AddController(c2);

            AnimationPipelineController.PauseAll();

            c1.Received().Pause();
            c2.Received().Pause();
        }
Esempio n. 4
0
        public void Destroy_Pipeline_Destroyed()
        {
            var ctx = Substitute.For <IWorldContext>();

            ctx.LogSystem.Returns(Substitute.For <ILogSystem>());
            var animation = new FloatAnimation <Transform>(new Transform(ctx), 0, 1, 1, v => { });

            var pipeline = AnimationPipeline <Transform> .Create(animation);

            var target = new AnimationPipelineController <Transform>(pipeline);

            target.Destroy();

            Assert.AreEqual(AnimationState.Stopped, pipeline.State);

            target.Pause();
            target.Resume();
        }
Esempio n. 5
0
 public override void Update()
 {
     Context.InputSystem
     .IsKeyDown(Keys.D1, () => ToogleAnimation(controller1))
     .IsKeyDown(Keys.D2, () => ToogleAnimation(controller2))
     .IsKeyDown(Keys.D3, () =>
     {
         ToogleAnimation(controller1);
         ToogleAnimation(controller2);
     })
     .IsKeyDown(Keys.D0, () =>
     {
         controller1.Destroy();
         controller2.Destroy();
     })
     .IsKeyDown(Keys.D7, () => AnimationPipelineController.PauseAll())
     .IsKeyDown(Keys.D8, () => AnimationPipelineController.ResumeAll())
     .IsKeyDown(Keys.D9, () => AnimationPipelineController.DestroyAll());
 }
Esempio n. 6
0
        private void StartAnimation()
        {
            AnimationPipelineController.DestroyAll();
            var easing = Easing.All[currentEasingIndex];

            // Ball.
            var left  = bounds.LeftCenterPoint();
            var right = bounds.RightCenterPoint() - new Point(20, 0);

            ball.Transform.CentralizePivot();
            ball.Transform.Position = left;
            ball.Transform.Scale    = Point.One;
            ball.Transform.Rotation = 0f;

            var duration = 4f;

            ball.Transform
            .MoveTo(right, duration, easing)
            .PingPong();

            ball.Transform
            .ScaleTo(20, 10, duration, easing)
            .PingPong();

            ball.Transform
            .RotateTo(360, duration, easing)
            .PingPong();

            for (int i = 0; i < bar.Length; i++)
            {
                var time = (float)i / (float)bar.Length;
                var y    = easing.Calculate(time);

                bar[i].Transform.Position = new Point(i + bounds.Left, bounds.Bottom);
                bar[i].Transform
                .MoveTo(new Point(i + bounds.Left, bounds.Top + (1f - y) * (bounds.Height)), duration, easing)
                .Once();
            }
        }
Esempio n. 7
0
 public void TearDown()
 {
     AnimationPipelineController.Clear();
 }