32 lines
1.3 KiB
C#
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);
|
|
}
|
|
}
|