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? _drawingShip = null;
|
|
public DrawingObjectShip(DrawningShip drawingShip)
|
|
{
|
|
_drawingShip = drawingShip;
|
|
}
|
|
public ObjectParameters? GetObjectPosition
|
|
{
|
|
get
|
|
{
|
|
if (_drawingShip == null || _drawingShip.EntityShip == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new ObjectParameters(_drawingShip.GetPosX, _drawingShip.GetPosY, _drawingShip.GetWidth, _drawingShip.GetHeight);
|
|
}
|
|
}
|
|
public int GetStep => (int)(_drawingShip?.EntityShip?.Step ?? 0);
|
|
public bool CheckCanMove(DirectionType direction) => _drawingShip?.CanMove(direction) ?? false;
|
|
public void MoveObject(DirectionType direction) => _drawingShip?.MoveTransport(direction);
|
|
}
|
|
}
|