33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
|
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);
|
|||
|
}
|
|||
|
}
|