PIbd-23_Vrazhkin_S_A_Electr.../lab1/DrawingObjectLocomotiv.cs

29 lines
1005 B
C#
Raw Permalink Normal View History

2023-10-03 11:53:51 +04:00
namespace ElectricLocomotive;
public class DrawingObjectLocomotiv : IMoveableObject
{
private readonly DrawingLocomotiv? _drawingLocomotiv = null;
public DrawingObjectLocomotiv(DrawingLocomotiv drawingLocomotiv)
{
_drawingLocomotiv = drawingLocomotiv;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawingLocomotiv == null || _drawingLocomotiv.EntityLocomotiv ==
null)
{
return null;
}
return new ObjectParameters(_drawingLocomotiv.GetPosX,
_drawingLocomotiv.GetPosY, _drawingLocomotiv.GetWidth, _drawingLocomotiv.GetHeight);
}
}
public int GetStep => (int)(_drawingLocomotiv?.EntityLocomotiv?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) =>
_drawingLocomotiv?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) =>
_drawingLocomotiv?.MoveTransport(direction);
}