Добален дополнительный конструктор и метод стал virtual

This commit is contained in:
Сергей Полевой 2022-09-26 18:36:46 +04:00
parent 40820059a5
commit fbd570c22d

View File

@ -15,10 +15,18 @@ namespace Artilleries
private int? _pictureHeight = null;
private readonly int _artilleryWidth = 80;
private readonly int _artilleryHeight = 50;
public DrawingArtillery(int speed, float weight, Color bodyColor)
{
Artillery = new EntityArtillery(speed, weight, bodyColor);
}
protected DrawingArtillery(int speed, float weight, Color bodyColor, int artilleryWidth, int artilleryHeight) : this(speed, weight, bodyColor)
{
_artilleryWidth = artilleryWidth;
_artilleryHeight = artilleryHeight;
}
public void SetPosition(int x, int y, int width, int height)
{
if (x < 0 || x + _artilleryWidth >= width)
@ -73,7 +81,7 @@ namespace Artilleries
}
}
public void DrawTransport(Graphics g)
public virtual void DrawTransport(Graphics g)
{
if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue)
{