ПИбд-23 Тихоненков А.Е. Лабораторная 2 #3
@ -16,12 +16,12 @@ namespace AntiAircraftGun.DrawingObjects
|
||||
public AdvancedDrawingAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor, Color dopColor, bool rocket,bool radar, int width, int height) :
|
||||
base(speed, weight, bodyColor, additionalColor, width, height)
|
||||
{
|
||||
AntiAirСraftGun = new EntityAdvancedAntiAircraftGun(speed, weight, bodyColor, additionalColor, dopColor, rocket,radar);
|
||||
AntiAirСraftGun = new EntityAdvancedAntiAirCraftGun(speed, weight, bodyColor, additionalColor, dopColor, rocket,radar);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (AntiAirСraftGun is not EntityAdvancedAntiAircraftGun advancedGun)
|
||||
if (AntiAirСraftGun is not EntityAdvancedAntiAirCraftGun advancedGun)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Enitites
|
||||
{
|
||||
public class EntityAdvancedAntiAircraftGun : EntityAntiAirCraftGun
|
||||
public class EntityAdvancedAntiAirCraftGun : EntityAntiAirCraftGun
|
||||
|
||||
{
|
||||
|
||||
public Color DopColor { get; private set; }
|
||||
@ -17,7 +17,7 @@ namespace AntiAircraftGun.Enitites
|
||||
|
||||
|
||||
|
||||
public EntityAdvancedAntiAircraftGun(int speed, double weight, Color bodyColor, Color additionalColor,Color dopColor, bool rocket, bool radar)
|
||||
public EntityAdvancedAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor,Color dopColor, bool rocket, bool radar)
|
||||
: base(speed, weight, bodyColor, additionalColor)
|
||||
{
|
||||
DopColor = dopColor;
|
||||
|
@ -9,28 +9,28 @@ namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
public class DrawingObjectAntiAirCraftGun : IMoveableObject
|
||||
{
|
||||
private readonly BaseDrawingAntiAirCraftGun? _drawningCar = null;
|
||||
private readonly BaseDrawingAntiAirCraftGun? _drawningAntiAirCraftGun = null;
|
||||
public DrawingObjectAntiAirCraftGun(BaseDrawingAntiAirCraftGun drawningCar)
|
||||
{
|
||||
_drawningCar = drawningCar;
|
||||
_drawningAntiAirCraftGun = drawningCar;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningCar == null || _drawningCar.AntiAirСraftGun ==
|
||||
if (_drawningAntiAirCraftGun == null || _drawningAntiAirCraftGun.AntiAirСraftGun ==
|
||||
null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningCar.GetPosX,
|
||||
_drawningCar.GetPosY, _drawningCar.GetWidth, _drawningCar.GetHeight);
|
||||
return new ObjectParameters(_drawningAntiAirCraftGun.GetPosX,
|
||||
_drawningAntiAirCraftGun.GetPosY, _drawningAntiAirCraftGun.GetWidth, _drawningAntiAirCraftGun.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawningCar?.AntiAirСraftGun?.Step ?? 0);
|
||||
public int GetStep => (int)(_drawningAntiAirCraftGun?.AntiAirСraftGun?.Step ?? 0);
|
||||
public bool CheckCanMove(DirectionType direction) =>
|
||||
_drawningCar?.CanMove(direction) ?? false;
|
||||
_drawningAntiAirCraftGun?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) =>
|
||||
_drawningCar?.MoveTransport(direction);
|
||||
_drawningAntiAirCraftGun?.MoveTransport(direction);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
Имя класса не соответствует указанному в задании