Exemplo n.º 1
0
        private void initializeAnimations()
        {
            BlinkAnimator loseLifeAnimation = new BlinkAnimator(
                "LoseLifeAnimation",
                k_NumOfBlinksInSecondInLoseLifeAnimation,
                TimeSpan.FromSeconds(k_LoseLifeAnimationLength));

            loseLifeAnimation.Finished += onFinishedLoseLifeAnimation;
            Animations.Add(loseLifeAnimation);
            loseLifeAnimation.Pause();

            RotateAnimator rotateAnimator = new RotateAnimator(
                k_NumOfCyclesPerSecondsInDeathAnimation,
                TimeSpan.FromSeconds(k_DeathAnimationLength));
            FaderAnimator faderAnimator = new FaderAnimator(TimeSpan.FromSeconds(k_DeathAnimationLength));

            this.DeathAnimation = new CompositeAnimator(
                "DeathAnimation",
                TimeSpan.FromSeconds(k_DeathAnimationLength),
                this,
                rotateAnimator,
                faderAnimator);

            Animations.Resume();
        }
Exemplo n.º 2
0
        private void initAnimations()
        {
            BlinkAnimator     blinkAnimator = new BlinkAnimator("hitByBulletAnimator", 6, TimeSpan.FromSeconds(2.5));
            CompositeAnimator destroyed     = new CompositeAnimator(
                "destroyedAnimator",
                TimeSpan.FromSeconds(2.5),
                this,
                new FadeAnimator("fadeAnimator", TimeSpan.FromSeconds(2.5)),
                new RotateAnimator("rotateAnimator", TimeSpan.FromSeconds(2.5), 4));

            blinkAnimator.Finished += new Action(() => { Position = m_InitialPosition; IsActive = true; Velocity = Vector2.Zero; });
            destroyed.Finished     += remove;
            Animations.Add(blinkAnimator);
            Animations.Add(destroyed);
            Animations.Resume();
            blinkAnimator.Pause();
            destroyed.Pause();
        }