2023-11-25 14:55:27 +04:00
|
|
|
|
using System;
|
2023-11-14 14:11:54 +04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.NetworkInformation;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2023-11-25 14:55:27 +04:00
|
|
|
|
using DoubleDeckerbus.Entities;
|
|
|
|
|
using DoubleDeckerbus.Drawing;
|
|
|
|
|
|
2023-12-15 20:07:22 +04:00
|
|
|
|
|
2023-11-25 14:55:27 +04:00
|
|
|
|
namespace DoubleDeckerbus.Move_Strategy
|
2023-11-14 14:11:54 +04:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
2023-11-25 14:55:27 +04:00
|
|
|
|
return new ObjectParameters(_drawingBus.GetPosX, _drawingBus.GetPosY, _drawingBus.GetWidth, _drawingBus.GetHeight);
|
2023-11-14 14:11:54 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|