Esempio n. 1
0
 public void SetRendererPreDraw(ImageBuffer background, RendererBase rendererToDrawWith, Player playerToCenterOn)
 {
     rendererToDrawWith.PushTransform();
     Vector2D windowCenter = new Vector2D(screenWindow.Left + (screenWindow.Right - screenWindow.Left) / 2, screenWindow.Bottom + (screenWindow.Top - screenWindow.Bottom) / 2);
     Vector2D playerPos = playerToCenterOn.Position;
     Vector2D playfieldOffset = windowCenter - playerPos;
     if (playfieldOffset.x > screenWindow.Left)
     {
         playfieldOffset.x = screenWindow.Left;
     }
     if (playfieldOffset.x < -background.Width() + screenWindow.Right)
     {
         playfieldOffset.x = -background.Width() + screenWindow.Right;
     }
     if (playfieldOffset.y > screenWindow.Bottom)
     {
         playfieldOffset.y = screenWindow.Bottom;
     }
     if (playfieldOffset.y < -background.Height() + screenWindow.Top)
     {
         playfieldOffset.y = -background.Height() + screenWindow.Top;
     }
     Affine translation = Affine.NewTranslation(playfieldOffset);
     rendererToDrawWith.SetTransform(rendererToDrawWith.GetTransform() * translation);
     rendererToDrawWith.SetClippingRect(screenWindow);
 }
Esempio n. 2
0
        public virtual void TakeDamage(double DamageToTake, Player playerThatDeliveredDamage)
		{
			Damage = Damage + DamageToTake;
		}