Пример #1
0
 /// <summary>
 /// Catch the end event raised by the component animation
 /// </summary>
 /// <param name="i_Animation">the animation that ended</param>
 protected virtual void ScaleAnimation_Finished(SpriteAnimation i_Animation)
 {
     Visible = false;
     Dying = false;
 }
Пример #2
0
 /// <summary>
 /// Catch the end event raised by the component animation
 /// </summary>
 /// <param name="i_Animation">the animation that ended</param>
 protected override void ScaleAnimation_Finished(SpriteAnimation i_Animation)
 {
     base.ScaleAnimation_Finished(i_Animation);
     m_MotherShipScaled = true;
 }
        /// <summary>
        /// Initiated by each observerd child animations, to check whether all child
        /// animations are done. Then composite animation will notify it is done.
        /// </summary>
        /// <param name="i_ChildAnimation"></param>
        private void childAnimation_Finished(SpriteAnimation i_ChildAnimation)
        {
            bool isFinished = true;

            // Checking if all animations are done
            foreach (SpriteAnimation animation in this.m_AnimationsList)
            {
                if (!animation.IsFinished)
                {
                    isFinished = false;
                    break;
                }
            }

            // If all animations are done then setting composite animation as done too
            if (isFinished)
            {
                this.IsFinished = true;
            }
        }
        /// <summary>
        /// Adds a new animations to list and dictionary
        /// </summary>
        /// <param name="i_Animation">New animations to be added. Name must be unique</param>
        public void Add(SpriteAnimation i_Animation)
        {
            i_Animation.BoundSprite = this.BoundSprite;
            i_Animation.Enabled = true;
            m_AnimationsDictionary.Add(i_Animation.Name, i_Animation);
            m_AnimationsList.Add(i_Animation);

            // Registers itself as an observer for child animations
            if (NotifyWhenAllAnimationsFinished)
            {
                i_Animation.Finished += new AnimationFinishedEventHandler(childAnimation_Finished);
            }
        }
Пример #5
0
 /// <summary>
 /// Catch a AnimationFinished event and make the component invisible
 /// </summary>
 /// <param name="i_Animation">the animation that ended</param>
 protected override void ScaleAnimation_Finished(SpriteAnimation i_Animation)
 {
     base.ScaleAnimation_Finished(i_Animation);
     OnInvaderWasHit();
 }
Пример #6
0
        /// <summary>
        /// Catch the animation ended event raised by the animations
        /// </summary>
        /// <param name="i_Animation">The animation that ended</param>
        public void spaceShip_DeathAnimationEnded(SpriteAnimation i_Animation)
        {
            Score -= k_LostLifeScoreDecrease;
            RemainingLives -= 1;
            onPlayerWasHit();

            if (m_RemainingLivesLeft <= 0)
            {
                onPlayerIsDead();
            }
            else
            {
                Animations.Pause();
                PositionForDraw = DefaultPosition;
            }
        }