PIbd-23-Kondratev-N.D.-Gaso.../GasolineTanker/ProjectGasolineTanker/MovementStratg/DrawingObjectTruck.cs
2024-10-03 00:46:41 +03:00

39 lines
1.3 KiB
C#

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
{
/// <summary>
/// Реализация интерфейса
/// </summary>
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);
}
}