PIbd22_Kuznetsov_A.V._Excav.../Excavator/DrawingObjectMash.cs

35 lines
1.2 KiB
C#

using Excavator.MovementStrategy;
using Excavator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using Excavator.DrawingObjects;
namespace Excavator.MovementStrategy
{
public class DrawingObjectMash : IMoveableObject
{
private readonly DrawingMash? _drawingMash = null;
public DrawingObjectMash(DrawingMash drawingMash)
{
_drawingMash = drawingMash;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawingMash == null || _drawingMash.EntityMash == null)
{
return null;
}
return new ObjectParameters(_drawingMash.GetPosX,_drawingMash.GetPosY, _drawingMash.GetWidth, _drawingMash.GetHeight);
}
}
public int GetStep => (int)(_drawingMash?.EntityMash?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) => _drawingMash?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) => _drawingMash?.MoveTransport(direction);
}
}