using System; using System.Collections.Generic; using System.Linq; using System.Net.NetworkInformation; using System.Text; using System.Threading.Tasks; using ProjectGasolineTanker.Drawings; using ProjectGasolineTanker.Entities; namespace ProjectGasolineTanker.MovementStratg { /// /// Реализация интерфейса /// public class DrawingObjectTruck : IMoveableObject { private readonly DrawingTruck? _drawingTruck = null; public DrawingObjectTruck(DrawingTruck drawingTruck) { _drawingTruck = drawingTruck; } public ObjectParameters? GetObjectPosition { get { if (_drawingTruck == null || _drawingTruck.EntityTruck == null) { return null; } return new ObjectParameters(_drawingTruck.GetPosX, _drawingTruck.GetPosY, _drawingTruck.GetWidth, _drawingTruck.GetHeight); } } public int GetStep => (int)(_drawingTruck?.EntityTruck?.Step ?? 0); public bool CheckCanMove(DirectionType direction) => _drawingTruck?.CanMove(direction) ?? false; public void MoveObject(DirectionType direction) => _drawingTruck?.MoveTransport(direction); } }