PIbd22_Kamcharova_K.A._Doub.../DoubleDeckerBus/DrawingObjectBus.cs

35 lines
1.2 KiB
C#

using DoubleDeckerbus.MovementStrategy;
using DoubleDeckerbus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using DoubleDeckerbus.DrawingObjects;
namespace DoubleDeckerbus.MovementStrategy
{
public class DrawingObjectBus : IMoveableObject
{
private readonly DrawingBus? _drawingBus = null;
public DrawingObjectBus(DrawingBus drawingBus)
{
_drawingBus = drawingBus;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawingBus == null || _drawingBus.EntityBus == null)
{
return null;
}
return new ObjectParameters(_drawingBus.GetPosX,_drawingBus.GetPosY, _drawingBus.GetWidth, _drawingBus.GetHeight);
}
}
public int GetStep => (int)(_drawingBus?.EntityBus?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) => _drawingBus?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) => _drawingBus?.MoveTransport(direction);
}
}