29 lines
1005 B
C#
29 lines
1005 B
C#
|
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);
|
|||
|
}
|