PIbd22_NikiforovaMV_Contain.../ContainerShip/DrawningObjectShip.cs

33 lines
1.1 KiB
C#
Raw Normal View History

2023-11-25 12:44:21 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ContainerShip.DrawningObjects;
namespace ContainerShip.MovementStrategy
{
public class DrawingObjectShip : IMoveableObject
{
private readonly DrawningShip? _drawingBus = null;
public DrawingObjectShip(DrawningShip drawingBus)
{
_drawingBus = drawingBus;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawingBus == null || _drawingBus.EntityShip == null)
{
return null;
}
return new ObjectParameters(_drawingBus.GetPosX, _drawingBus.GetPosY, _drawingBus.GetWidth, _drawingBus.GetHeight);
}
}
public int GetStep => (int)(_drawingBus?.EntityShip?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) => _drawingBus?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) => _drawingBus?.MoveTransport(direction);
}
}