Ejemplo n.º 1
0
        public override void Initialize()
        {
            if (!IsInitialized)
            {
                base.Initialize();
                this.Gun.Initialize();
                JumpMovementAnimator jump = new JumpMovementAnimator(TimeSpan.FromSeconds(k_JumpAnimationIntervals), TimeSpan.Zero);
                CompositeAnimator    dead = new CompositeAnimator(
                    k_DeadAnimatorName,
                    TimeSpan.FromSeconds(k_RotationAnimationLength),
                    this,
                    new RotationAnimator(k_NumOfCirclesInOneSecond, TimeSpan.FromSeconds(k_RotationAnimationLength)),
                    new ShrinkAnimator(TimeSpan.FromSeconds(k_ShrinkAnimationLength)));

                this.Animations.Add(CellAnimation);
                this.Animations.Add(dead);
                this.Animations.Add(jump);
                this.Animations.Pause();

                CellAnimation.Resume();
                jump.Resume();
                dead.Finished += dead_Finished;

                this.Animations.Enabled = true;
            }
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();

            m_Animations   = new CompositeAnimator(this);
            m_SoundManager = Game.Services.GetService(typeof(SoundManager)) as SoundManager;
        }
          public override void Initialize()
          {
               base.Initialize();

               Animations = new CompositeAnimator(this);
               IsInitialized = true;
          }
Ejemplo n.º 4
0
        public PlayerSpaceShip(
            Game i_Game,
            GameScreen i_Screen,
            string i_GameAsset,
            ShootsManager i_ShootsManager,
            bool i_IsFirstPlayer)
            : base(i_Game, i_Screen, i_GameAsset, i_ShootsManager)
        {
            m_NumOFSouls    = k_StartingNumOfSouls;
            DrawOrder       = k_DrawOrder;
            m_IsFirstPlayer = i_IsFirstPlayer;
            m_Animator      = new CompositeAnimator(this);
            CompositeAnimator lostSoulAnimation = new CompositeAnimator("lostSoul", TimeSpan.FromSeconds(1.6), this,
                                                                        new BlinkAnimator("lostSoulBlink", TimeSpan.FromSeconds(1 / 14), TimeSpan.FromSeconds(2.4)));
            CompositeAnimator dieAnimation = new CompositeAnimator("dying", TimeSpan.FromSeconds(1.6), this,
                                                                   new RotateAnimator("dyingRotate", TimeSpan.FromSeconds(2.4), 4),
                                                                   new FadeOutAnimator("dyingFade", TimeSpan.FromSeconds(2.4)));

            m_Animator.Add(dieAnimation);
            m_Animator.Add(lostSoulAnimation);
            dieAnimation.Enabled      = false;
            lostSoulAnimation.Enabled = false;
            m_SoulsSprites            = new Soul[3];
            m_SoulsSprites[0]         = new Soul(i_Game, i_Screen, i_GameAsset);
            m_SoulsSprites[1]         = new Soul(i_Game, i_Screen, i_GameAsset);
            m_SoulsSprites[2]         = new Soul(i_Game, i_Screen, i_GameAsset);
            foreach (Soul soul in m_SoulsSprites)
            {
                Screen.Add(soul);
            }
        }
Ejemplo n.º 5
0
 public Sprite(Game game, GameScreen i_Screen, string i_AssetName, Color i_Color) : base(game)
 {
     r_AssetName        = i_AssetName;
     m_Color            = i_Color;
     m_Animator         = new CompositeAnimator(this);
     m_Animator.Enabled = true;
     m_Screen           = i_Screen;
 }
Ejemplo n.º 6
0
        private void dead_Finished(object i_Sender, EventArgs i_Args)
        {
            CompositeAnimator animator = i_Sender as CompositeAnimator;

            animator.Pause();
            this.Visible = false;
            this.Enabled = false;
        }
Ejemplo n.º 7
0
        private void deadAnimator_Finished(object i_Sender, EventArgs i_Args)
        {
            CompositeAnimator spriteAnimator = i_Sender as CompositeAnimator;

            spriteAnimator.Pause();
            this.Visible           = false;
            this.IsDuringAnimation = false;
        }
Ejemplo n.º 8
0
 public MenuItem(Game i_Game, MenuScreen i_Screen, string i_Description, Color i_InactiveColor, Color i_ActiveColor) :
     base(i_Game, i_Screen, "")
 {
     m_Color         = i_InactiveColor;
     m_Description   = i_Description;
     m_InactiveColor = i_InactiveColor;
     m_ActiveColor   = i_ActiveColor;
     m_Animator      = new CompositeAnimator(this);
     m_Animator.Add(new Animators.ConcreteAnimators.PulseAnimator(k_Active, TimeSpan.Zero, 1.5f, 2));
 }
Ejemplo n.º 9
0
        private void createHitAnimator()
        {
            TimeSpan          animationLength = TimeSpan.FromSeconds(k_HitAnimatorDuration);
            TimeSpan          blinkDuration   = TimeSpan.FromSeconds(1f / (float)k_NumOfBlinksOnHitPerSecond);
            BlinkAnimator     blinkAnimator   = new BlinkAnimator(blinkDuration, animationLength);
            CompositeAnimator hitAnimator     = new CompositeAnimator(
                "Hit Animator", animationLength, this, blinkAnimator);

            this.Animations.Add(hitAnimator);
        }
Ejemplo n.º 10
0
        private void initAnimations()
        {
            BlinkAnimator blinkAnimator = new BlinkAnimator("LoosingSoul", TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(2.5));

            this.Animations.Add(blinkAnimator);
            RoataterAnimator  roataterAnimator = new RoataterAnimator(4, TimeSpan.FromSeconds(2.5));
            FadeAnimator      fadeAnimator     = new FadeAnimator(TimeSpan.FromSeconds(2.5));
            CompositeAnimator DestroyAnimator  = new CompositeAnimator("Destroy", TimeSpan.FromSeconds(2.5), this, fadeAnimator, roataterAnimator);

            this.Animations.Add(DestroyAnimator);
        }
Ejemplo n.º 11
0
        private void createDeathAnimator()
        {
            TimeSpan          animationLength = TimeSpan.FromSeconds(k_InvaderShrinkAndRotateAnimationTime);
            ShrinkAnimator    shrinkAnimator  = new ShrinkAnimator(animationLength);
            RotateAnimator    rotateAnimator  = new RotateAnimator(k_NumOfRotationsPerSecond, animationLength);
            CompositeAnimator deathAnimator   =
                new CompositeAnimator("Death Animator", animationLength, this, shrinkAnimator, rotateAnimator);

            this.Animations.AddWithoutEnabling(deathAnimator);
            Hit += Animations_Death;
        }
Ejemplo n.º 12
0
        private void createDeathAnimator()
        {
            TimeSpan          animationLength = TimeSpan.FromSeconds(k_DeathAnimatorDuration);
            RotateAnimator    rotateAnimator  = new RotateAnimator(k_NumOfRotationsOnDeathPerSecond, animationLength);
            FadeAnimator      fadeAnimator    = new FadeAnimator(animationLength);
            CompositeAnimator deathAnimator   = new CompositeAnimator(
                "Death Animator", animationLength, this, rotateAnimator, fadeAnimator);

            this.Animations.AddWithoutEnabling(deathAnimator);
            Death += animations_Death;
        }
Ejemplo n.º 13
0
        public EnemyMotherShip(Game i_Game, GameScreen i_Screen, ShootsManager i_ShootsManager) :
            base(i_Game, i_Screen, @"Sprites/MotherShip_32x120", k_PointsForKill, i_ShootsManager, Color.Red)
        {
            m_Animator = new CompositeAnimator(this);
            CompositeAnimator dieAnimation = new CompositeAnimator("dying", TimeSpan.FromSeconds(1.6), this,
                                                                   new ShrinkAnimator("dyingShrink", TimeSpan.FromSeconds(2.4)),
                                                                   new BlinkAnimator("dyingBlink", TimeSpan.FromSeconds(0.2), TimeSpan.FromSeconds(2.4)),
                                                                   new FadeOutAnimator("dyingFade", TimeSpan.FromSeconds(2.4)));

            m_Animator.Add(dieAnimation);
        }
Ejemplo n.º 14
0
        private void initAnimations()
        {
            BlinkAnimator  blinkAnimator  = new BlinkAnimator(TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(2.2));
            FadeAnimator   fadeAnimator   = new FadeAnimator(TimeSpan.FromSeconds(2.2));
            ShrinkAnimator shrinkAnimator = new ShrinkAnimator(TimeSpan.FromSeconds(2.2));

            CompositeAnimator DestroyAnimator2 = new CompositeAnimator("DestroyMother", TimeSpan.FromSeconds(2.2), this, fadeAnimator, blinkAnimator, shrinkAnimator);

            this.Animations.Add(DestroyAnimator2);
            Animations["DestroyMother"].Finished += new EventHandler(this.destroyed_Finished);
        }
Ejemplo n.º 15
0
 public override void Initialize()
 {
     base.Initialize();
     m_JumpAnimators = new CompositeAnimator(this);
     TintColor       = r_EnemyData.EnemyColor;
     Position        = r_EnemyData.EnemyStartPosition;
     Height          = k_TextureSize;
     Width           = k_TextureSize;
     addKillingAnimations();
     addJumpAnimations();
     initTimer();
 }
Ejemplo n.º 16
0
        private void initAnimations()
        {
            Animations.Add(new CellAnimator(m_Comander.SecondsBetweenJumps, TimeSpan.Zero, m_TextureCellsIdx));
            ShrinkAnimator shrinkAnimator = new ShrinkAnimator("ShrinkAnimator", TimeSpan.FromSeconds(1.2));
            RotateAnimator rotateAnimator = new RotateAnimator("RotateAnimator", TimeSpan.FromSeconds(1.2), 6);

            m_DyingAnimator = new CompositeAnimator("DieAnimator", TimeSpan.FromSeconds(1.2), this, shrinkAnimator, rotateAnimator);
            m_DyingAnimator.ResetAfterFinish = false;
            Animations.Add(m_DyingAnimator);
            m_DyingAnimator.Finished += remove;
            Animations.Resume();
            m_DyingAnimator.Pause();
        }
Ejemplo n.º 17
0
        private void createDeathAnimator()
        {
            TimeSpan          animationLength = TimeSpan.FromSeconds(k_DeathAnimatorDuration);
            TimeSpan          blinkDuration   = TimeSpan.FromSeconds(k_DeathBlinkDuration);
            ShrinkAnimator    shrinkAnimator  = new ShrinkAnimator(animationLength);
            FadeAnimator      fadeAnimator    = new FadeAnimator(animationLength);
            BlinkAnimator     blinkAnimator   = new BlinkAnimator(blinkDuration, animationLength);
            CompositeAnimator deathAnimator   = new CompositeAnimator(
                "Death Animator", animationLength, this, shrinkAnimator, fadeAnimator, blinkAnimator);

            this.Animations.Add(deathAnimator);
            Death += Animations_Death;
        }
Ejemplo n.º 18
0
        private void initAnimations()
        {
            ShrinkAnimator    shrinker           = new ShrinkAnimator(TimeSpan.FromSeconds(1.2));
            RoataterAnimator  rotate             = new RoataterAnimator(6, TimeSpan.FromSeconds(1.2));
            CompositeAnimator dyingEnemy         = new CompositeAnimator("dyingEnemy", TimeSpan.FromSeconds(1.2), this, shrinker, rotate);
            CellAnimator      enemyCellAnimation = new CellAnimator(this.m_TimeUntilNextStepInSec, 2, TimeSpan.Zero, this.m_StartSqureIndex, true, this.m_Toggeler);

            this.Animations.Add(enemyCellAnimation);
            this.Animations.Add(dyingEnemy);

            this.PositionChanged   += new EventHandler <EventArgs>(this.cellAnimationPosition_Changed);
            dyingEnemy.Finished    += new EventHandler(this.dyingEnemy_Finished);
            this.Animations.Enabled = true;
        }
Ejemplo n.º 19
0
        private void initAnimations()
        {
            CompositeAnimator dyingAnimator = new CompositeAnimator(
                "dyingAnimator",
                TimeSpan.FromSeconds(2.2),
                this,
                new FadeAnimator("fader", TimeSpan.FromSeconds(2.2)),
                new ShrinkAnimator("shrinker", TimeSpan.FromSeconds(2.2)),
                new BlinkAnimator("blinker", 6, TimeSpan.FromSeconds(2.2)));

            dyingAnimator.Finished += new Action(() => { m_IsInGame = false; Visible = false; });
            Animations.Add(dyingAnimator);
            dyingAnimator.Pause();
            Animations.Resume();
        }
Ejemplo n.º 20
0
        private void initAnimations()
        {
            m_AnimatorForHit         = new CompositeAnimator(this, "ShipBlink");
            m_AnimatorForDestruction = new CompositeAnimator(this, "KillShip");
            RotateAnimator rotateAnimator = new RotateAnimator(TimeSpan.FromSeconds(k_RotaionLength), k_RotaionPerSec);
            BlinkAnimator  blinkAnimator  = new BlinkAnimator(TimeSpan.FromSeconds(k_BlinkLength), TimeSpan.FromSeconds(k_AnimationBlinkLength));
            FadeAnimator   fadeAnimator   = new FadeAnimator(TimeSpan.FromSeconds(k_FadeLength));

            rotateAnimator.Finished += onkillSpaceShip;
            blinkAnimator.Finished  += onFinsihAfterHit;
            m_AnimatorForHit.Add(blinkAnimator);
            m_AnimatorForDestruction.Add(fadeAnimator);
            m_AnimatorForDestruction.Add(rotateAnimator);
            this.Animations = m_AnimatorForHit;
        }
Ejemplo n.º 21
0
        private void initAnimations()
        {
            m_AnimationWhenDead      = new CompositeAnimator(this, "AnimationWhenDead");
            m_AnimationChangeTexture = new CompositeAnimator(this, "ChangeTexture");
            CellAnimator   cellAnimator   = new CellAnimator(TimeSpan.FromSeconds(m_TimeToJump), k_NumOfFrames, TimeSpan.FromSeconds(0), r_EnemyType % 2, false);
            ShrinkAnimator shrinkAnimator = new ShrinkAnimator(TimeSpan.FromSeconds(k_AnnimationTime));
            RotateAnimator rotateAnimator = new RotateAnimator(TimeSpan.FromSeconds(k_AnnimationTime), k_SpinPerSec);

            m_AnimationChangeTexture.Add(cellAnimator);
            m_AnimationWhenDead.Add(shrinkAnimator);
            m_AnimationWhenDead.Add(rotateAnimator);
            shrinkAnimator.Finished += killEnemy;
            this.Animations          = m_AnimationChangeTexture;
            this.Animations.Resume();
        }
Ejemplo n.º 22
0
        public override void Initialize()
        {
            base.Initialize();
            CompositeAnimator deadAnimator = new CompositeAnimator(
                k_DeadAnimatorName,
                TimeSpan.FromSeconds(k_DeadAnimationLength),
                this,
                new BlinkAnimator(TimeSpan.FromSeconds(k_BlinkLength), TimeSpan.FromSeconds(k_DeadAnimationLength)),
                new ShrinkAnimator(TimeSpan.FromSeconds(k_DeadAnimationLength)),
                new TransparencyAnimator(TimeSpan.FromSeconds(k_DeadAnimationLength)));

            deadAnimator.Finished += deadAnimator_Finished;
            this.Animations.Add(deadAnimator);
            this.Animations.Pause();
            this.Animations.Enabled = true;
        }
Ejemplo n.º 23
0
        private void initAnimations()
        {
            BlinkAnimator blinkAnimator = new BlinkAnimator("LoosingSoul", TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(2.5));//TODO: numbers?

            this.Animations.Add(blinkAnimator);

            FadeAnimator fadeAnimator = new FadeAnimator(TimeSpan.FromSeconds(4.5));

            SpriteAnimator[]  destriyAnimations        = { fadeAnimator };
            CompositeAnimator spaceShipDestroyAnimator = new CompositeAnimator("Destroy", TimeSpan.FromSeconds(2.5), this, destriyAnimations);

            spaceShipDestroyAnimator.ResetAfterFinish = false;
            m_Animations.Add(spaceShipDestroyAnimator);

            this.Animations.Enabled = true;
        }
Ejemplo n.º 24
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();
        }
Ejemplo n.º 25
0
        public override void Initialize()
        {
            base.Initialize();

            BlinkAnimator     lostLife = new BlinkAnimator(TimeSpan.FromSeconds(k_BlinkLength), TimeSpan.FromSeconds(k_BlinksAnimationLength));
            CompositeAnimator dead     = new CompositeAnimator(
                k_DeadAnimatorName,
                TimeSpan.FromSeconds(k_DeadAnimationLength),
                this,
                new RotationAnimator(k_RotationPerSeconed, TimeSpan.FromSeconds(k_DeadAnimationLength)),
                new TransparencyAnimator(TimeSpan.FromSeconds(k_DeadAnimationLength)));

            dead.Finished     += dead_Finished;
            lostLife.Finished += lostLife_Finished;

            this.Animations.Add(dead);
            this.Animations.Add(lostLife);
            this.Animations.Pause();
            this.Animations.Enabled = true;
        }
Ejemplo n.º 26
0
        public EnemySmallSpaceShip(
            Game i_Game,
            GameScreen i_Screen,
            ShootsManager i_ShootsManager,
            string i_AssetName,
            Color i_Color,
            int i_PointsForKill,
            params Rectangle[] i_SourceRectangle) :
            base(i_Game, i_Screen, @"Sprites/EnemySquares", i_PointsForKill, i_ShootsManager, i_Color)
        {
            m_SourceRectangles     = new Rectangle[2];
            m_SourceRectangles[0]  = i_SourceRectangle[0];
            m_SourceRectangles[1]  = i_SourceRectangle[1];
            m_SourceRectangle      = m_SourceRectangles[0];
            isUsingSourceRectangle = true;
            m_Animator             = new CompositeAnimator(this);
            CompositeAnimator dieAnimation = new CompositeAnimator("dying", TimeSpan.FromSeconds(1.6), this,
                                                                   new ShrinkAnimator("dyingShrink", TimeSpan.FromSeconds(1.6)),
                                                                   new RotateAnimator("dyingRotate", TimeSpan.FromSeconds(1.6), 6));

            m_Animator.Add(dieAnimation);
            m_RndMaxValue = k_RndMaxValueLevel1;
        }
Ejemplo n.º 27
0
        public override void Initialize()
        {
            base.Initialize();

            m_Animations = new CompositeAnimator(this);
        }
Ejemplo n.º 28
0
 public Sprite(string i_AssetName, Game i_Game, int i_UpdateOrder, int i_DrawOrder)
     : base(i_AssetName, i_Game, i_UpdateOrder, i_DrawOrder)
 {
     m_Animations = new CompositeAnimator(this);
 }