2023-11-23 01:37:55 +04:00
|
|
|
|
|
2023-11-30 02:09:48 +04:00
|
|
|
|
using ProjectBulldozer.Drawning;
|
2023-11-23 01:37:55 +04:00
|
|
|
|
namespace ProjectBulldozer.MovementStrategy
|
|
|
|
|
{
|
|
|
|
|
public class DrawingObjectTractor : IMoveableObject
|
|
|
|
|
{
|
|
|
|
|
private readonly DrawingTractor? _drawningTractor = null;
|
|
|
|
|
|
|
|
|
|
public DrawingObjectTractor(DrawingTractor drawningTractor)
|
|
|
|
|
{
|
|
|
|
|
_drawningTractor = drawningTractor;
|
|
|
|
|
}
|
|
|
|
|
public ObjectParameters? GetObjectPosition
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_drawningTractor == null || _drawningTractor.EntityTractor == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new ObjectParameters(_drawningTractor.GetPosX,
|
|
|
|
|
_drawningTractor.GetPosY, _drawningTractor.GetWidth, _drawningTractor.GetHeight);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public int GetStep => (int)(_drawningTractor?.EntityTractor?.Step ?? 0);
|
|
|
|
|
public bool CheckCanMove(DirectionType direction) => _drawningTractor?.CanMove(direction) ?? false;
|
|
|
|
|
public void MoveObject(DirectionType direction) => _drawningTractor?.MoveTransport(direction);
|
|
|
|
|
}
|
|
|
|
|
}
|