示例#1
0
 public void Update(Camera2D camera)
 {
     if (AttachedProjectile.X <= camera.Bounds.Left + m_iconOffset)
     {
         X = m_iconOffset;
     }
     else if (AttachedProjectile.X > camera.Bounds.Right - m_iconOffset)
     {
         X = 1320 - m_iconOffset;
     }
     else
     {
         X = AttachedProjectile.X - camera.TopLeftCorner.X;
     }
     if (AttachedProjectile.Y <= camera.Bounds.Top + m_iconOffset)
     {
         Y = m_iconOffset;
     }
     else if (AttachedProjectile.Y > camera.Bounds.Bottom - m_iconOffset)
     {
         Y = 720 - m_iconOffset;
     }
     else
     {
         Y = AttachedProjectile.Y - camera.TopLeftCorner.Y;
     }
     Rotation                  = CDGMath.AngleBetweenPts(camera.TopLeftCorner + Position, AttachedProjectile.Position);
     m_iconBG.Position         = Position;
     m_iconBG.Rotation         = Rotation;
     m_iconProjectile.Position = Position;
     m_iconProjectile.Rotation = AttachedProjectile.Rotation;
     m_iconProjectile.GoToFrame(AttachedProjectile.CurrentFrame);
 }