PIbd-23-Kondratev-N.D.-Gaso.../GasolineTanker/ProjectGasolineTanker/MovementStratg/DrawingObjectTruck.cs

39 lines
1.3 KiB
C#
Raw Normal View History

2024-10-03 01:40:53 +04:00
using System;
2024-10-03 01:16:11 +04:00
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
2024-10-03 01:40:53 +04:00
using ProjectGasolineTanker.Drawings;
using ProjectGasolineTanker.Entities;
2024-10-03 01:16:11 +04:00
2024-10-03 01:40:53 +04:00
namespace ProjectGasolineTanker.MovementStratg
2024-10-03 01:16:11 +04:00
{
2024-10-03 01:46:41 +04:00
/// <summary>
/// Реализация интерфейса
/// </summary>
2024-10-03 01:16:11 +04:00
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;
}
2024-10-03 01:40:53 +04:00
return new ObjectParameters(_drawingTruck.GetPosX, _drawingTruck.GetPosY, _drawingTruck.GetWidth, _drawingTruck.GetHeight);
2024-10-03 01:16:11 +04:00
}
}
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);
}
2024-10-03 01:40:53 +04:00
}