PIbd-21_KozyrevSS_GasolineT.../Lab/DrawingObjectTanker.cs
2023-11-14 23:39:34 +04:00

33 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lab.DrawningObjects;
namespace Lab.MovementStrategy
{
public class DrawingObjectTanker : IMoveableObject
{
private readonly DrawTanker? _drawTanker = null;
public DrawingObjectTanker(DrawTanker drawTanker )
{
_drawTanker = drawTanker;
}
public ObjectParameters? GetObjectParameters
{
get
{
if (_drawTanker == null || _drawTanker._gasolineTanker == null)
return null;
return new ObjectParameters(_drawTanker.GetPosX, _drawTanker.GetPosY, _drawTanker.GetWidth, _drawTanker.GetHeight);
}
}
public int GetStep => (int)(_drawTanker?._gasolineTanker?.Step ?? 0);
public bool CheckCanMove(Direction direction) => _drawTanker?.CanMove(direction) ?? false;
public void MoveObject(Direction direction) => _drawTanker?.MoveTransport(direction);
}
}