PIbd-23_Starostin_I.K._Lain.../lainer/Lainer1/DrawingObjectLainer.cs

33 lines
1.2 KiB
C#

using ProjectLainer.MovementStrategy;
using ProjectLainer.DrawningObjects;
using ProjectLainer.DrawningObjects;
namespace ProjectLainer.MovementStrategy
{
public class DrawningObjectLainer : IMoveableObject
{
private readonly DrawingLainer? _drawningLainer = null;
public DrawningObjectLainer(DrawingLainer drawningLainer)
{
_drawningLainer = drawningLainer;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawningLainer == null || _drawningLainer.EntityLainer == null)
{
return null;
}
return new ObjectParameters(_drawningLainer.GetPosX,
_drawningLainer.GetPosY, _drawningLainer.GetWidth, _drawningLainer.GetHeight);
}
}
public int GetStep => (int)(_drawningLainer?.EntityLainer?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) =>
_drawningLainer?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) =>
_drawningLainer?.MoveTransport(direction);
}
}