PIbd-21_KozyrevSS_GasolineT.../Lab/DrawingObjectTanker.cs

33 lines
1.0 KiB
C#
Raw Normal View History

2023-09-26 19:32:10 +04:00
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
{
2023-11-14 23:39:34 +04:00
if (_drawTanker == null || _drawTanker._gasolineTanker == null)
2023-09-26 19:32:10 +04:00
return null;
return new ObjectParameters(_drawTanker.GetPosX, _drawTanker.GetPosY, _drawTanker.GetWidth, _drawTanker.GetHeight);
}
}
2023-11-14 23:39:34 +04:00
public int GetStep => (int)(_drawTanker?._gasolineTanker?.Step ?? 0);
2023-09-26 19:32:10 +04:00
public bool CheckCanMove(Direction direction) => _drawTanker?.CanMove(direction) ?? false;
public void MoveObject(Direction direction) => _drawTanker?.MoveTransport(direction);
}
}