36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.NetworkInformation;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using DoubleDeckerbus.Entities;
|
|
using DoubleDeckerbus.Drawing;
|
|
|
|
|
|
namespace DoubleDeckerbus.Move_Strategy
|
|
{
|
|
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);
|
|
}
|
|
} |