PIbd-23-Kondratev-N.D.-Gaso.../GasolineTanker/ProjectGasolineTanker/DrawingObjectTruck.cs
2024-10-03 00:16:11 +03:00

35 lines
1.2 KiB
C#

using ProjectGasolineTanker.MovementStrategy;
using ProjectGasolineTanker;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using ProjectGasolineTanker.DrawingObjects;
namespace ProjectGasolineTanker.MovementStrategy
{
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);
}
}