PIbd-22_Kurbanova_A.A.Warml.../WarmlyLocomotive/DrawningObjectWarmlyLocomotive.cs
2023-11-11 21:26:13 +04:00

32 lines
1.3 KiB
C#

using WarmlyLocomotive.DrawningObjects;
namespace WarmlyLocomotive.MovementStrategy
{
internal class DrawningObjectWarmlyLocomotive : IMoveableObject
{
private readonly DrawningWarmlyLocomotive? _drawningWarmlyLocomotive = null;
public DrawningObjectWarmlyLocomotive(DrawningWarmlyLocomotive drawningWarmlylocomotive)
{
_drawningWarmlyLocomotive = drawningWarmlylocomotive;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawningWarmlyLocomotive == null || _drawningWarmlyLocomotive.EntityWarmlyLocomotive ==
null)
{
return null;
}
return new ObjectParameters(_drawningWarmlyLocomotive.GetPosX,
_drawningWarmlyLocomotive.GetPosY, _drawningWarmlyLocomotive.GetWidth, _drawningWarmlyLocomotive.GetHeight);
}
}
public int GetStep => (int)(_drawningWarmlyLocomotive?.EntityWarmlyLocomotive?.Step ?? 0);
public bool CheckCanMove(Direction direction) =>
_drawningWarmlyLocomotive?.CanMove(direction) ?? false;
public void MoveObject(Direction direction) =>
_drawningWarmlyLocomotive?.MoveTransport(direction);
}
}