Ejemplo n.º 1
0
 public override void Update(Player player, TimeSpan elapsedTime)
 {
     if (animationTimer != null)
     {
         animationTimer.Update(elapsedTime);
         if (animationTimer.Done)
         {
             animationTimer.IntervalOcccured -= HandleAnimation;
             animationTimer = null;
             canDraw        = false;
             ObjectManager.GetCell(Position).Remove(this);
         }
     }
 }
Ejemplo n.º 2
0
        public void Update(TimeSpan elapsedTime)
        {
            switch (m_State)
            {
            case BulletState.Flying:
                if (animationTimer != null)
                {
                    animationTimer.Update(elapsedTime);
                    if (animationTimer.Done)
                    {
                        animationTimer.IntervalOcccured -= HandleAnimation;
                        animationTimer = null;
                        CanDelete      = true;
                        return;
                    }
                }
                float t = Vector2.DistanceSquared(Position, m_InitialPosition);
                if (t > 250000)
                {
                    animationTimer.IntervalOcccured -= HandleAnimation;
                    animationTimer = null;
                    CanDelete      = true;
                    return;
                }
                Move((Velocity * m_Heading) + playerVelocity, elapsedTime);
                m_Bounds.X = (int)Position.X - Width / 2;
                m_Bounds.Y = (int)Position.Y - Height / 2;
                break;


            case BulletState.Contact:
                PlasmaHitAnimationTimer.Update(elapsedTime);
                if (PlasmaHitAnimationTimer.Done)
                {
                    CanDelete = true;
                }
                break;
            }
        }