35 lines
1.3 KiB
C#

using ElectricLocomotive.DrawningObject;
using ElectricLocomotive.MovementStrategy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectricLocomotive
{
public class DrawningObjectLocomotive : IMoveableObject
{
private readonly DrawningLocomotive? _drawningLocomotive = null;
public DrawningObjectLocomotive(DrawningLocomotive drawningLocomotive)
{
_drawningLocomotive = drawningLocomotive;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawningLocomotive == null || _drawningLocomotive.EntityLocomotive == null)
{
return null;
}
return new ObjectParameters(_drawningLocomotive.GetPosX,_drawningLocomotive.GetPosY, _drawningLocomotive.GetWidth, _drawningLocomotive.GetHeight);
}
}
public int GetStep => (int)(_drawningLocomotive?.EntityLocomotive?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) =>_drawningLocomotive?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) =>_drawningLocomotive?.MoveTransport(direction);
}
}